Posts: 149
Registered: ‎03-06-2013
Kudos: 56
Solutions: 1

mPort custom analog sensor does not report to controller

This is my first experience with custom sensors, and so far it has not gone well.  I hope someone knowledgeable about this is still around.


The sensor is a capacitve soil moisture sensor with 0 to +3 Volt output.  I attenuated this to 0 to 2 Volts for presentation to Port 3.


Just to get acquainted I tried selecting the standard "Input Analog" sensor.  It works as expected; reports the attenuated analog value to the mFi controller where it appears on the Devices page and is available for rule making.  But I need control of the power and digital output pins (set power to off and output to 5 Volts) so I composed the following JSON configuration:


{"VH400 Moisture Sensor" : {
    "desc" : "soil moisture volume water content",
    "analog" : true,
    "rj45_v1" : false,
    "tblock_v1" : true,
    "output" : true,
    "do_volt0" : 5,
    "pwr_volt" : 0,
    "rep_analog" : 1,
    "rep_sum" : 0,
    "rep_rms" : 0,
    "rep_input0" : 0,
    "default_tag" : "volts",
    "analog_tag" : "sensor volts",
    "conversion" : "xyz*1.465",
    "unit" : "Volts",
    "precision" : 2



I removed the standard sensor, restarted the mPort, and installed the custom sensor.  I then had proper control over the power and output pins, but the analog value is not reported to the controller.  It does not appear on the Devices page and is not available for making rules.


The inside workings of the mPort seem to be proper.  Telnetting in, the analog input value and the conversion result are visible at /proc/analog/ai3 and /proc/analog/value3.  I have tried many variations of the JSON configuration but none allows the value to be reported.


Can anyone please suggest what I have done wrong, and how to correct it?


Many thanks for your attention.