Mysensors S_POWER sensor and V_VAR1 value not supported?

Hi, I’ve seen a few threads about this topic but never saw a conclusion on what will happen with it. I understand from these threads the validation in HA will not allow the S_POWER sensor to report a V_VAR1 value, although V_VAR1 should be allowed for any sensor according to the Mysensors serial-API.

In essence I’m using the Pulse Power Meter sketch from mysensors: https://www.mysensors.org/build/pulse_power but have changed the sketch to only use one value per child_id, as described in various threads here already.

Both the V_KWH and V_WATT values are reported fine in HA, but the V_VAR1 is not accepted and hence no sensor is created and presented in HA.

Will this be supported in coming HA releases? I’m currently on 0.56.2.

Thanks,
ShaakTiHA

The goal is that home assistant should follow the mysensors serial api as far as possible, but still validate messages and the use of the api. I think we could try to allow V_VAR1-5 for all child types, but I haven’t looked at it in detail.

Meanwhile you can work around the problem you’re facing by changing the child type to S_CUSTOM, for the child that needs to report V_VAR1.

Ok, will try the work around for now. It sounds like this will work.

Thanks.

1 Like

Did you get your power meter running?
I tried the example sketch, but it doesn’t work.
Tried to replace S_POWER with S_CUSTOM but, no luck…

I am also struggling with this and I am a bit of a noob as well. If there is a fix can anybody share the sketch code? Also how to do the fix at the top with one child for W and one for kWh.

Thanks

I think I solved this.
Check here. https://forum.mysensors.org/topic/4819/power-meter-pulse-sensor/129
I posted my sketch 2 days ago.
I got another problem, the watt value is not reported right. I don’t think it is because I modified the sketch, because I got the same problem with the original example.

The first thing this node will do is request the pulse count value from the controller. But that value doesn’t exist. I had to manually set that value in my mysensors.json file. Don’t know if there is a better way to do it.

1 Like

Hi,

My sketch is very similar to the one @xydix posted above, where there are separate child ids for each of the three measurements. I also used a S_CUSTOM type instead of S_POWER for counting the pulses.

The only difference I can see is that I do not use a built in PULL_UP resistor, but then again I’m using a different sensor detecting the pulses from my energy meter.

Looking at the printout in the linked thread it looks like you get about 12 pulses during the 20 seconds interval before sending the data to the controller. Assuming a fairly constant consumption I guess your watt calculation should give you something like 2160W instead of the 121000W - 122000W you see. Perhaps you can try to print the value of the ‘interval’ parameter within the onPulse function to verify that the interrupts from the light sensor is behaving as expected and you get them at the same interval as the pulses on the power meter itself. I have not used the LM393 myself, but perhaps you need to tune it to detect and report the pulses properly.

Hope you can find some clues as to why the watt measurement is not working.

Hi, please could you tellm how did you set the value in mysensors.json file? thanks

Hi. I will try to help. It was i while ago and when i look at this today i have some problem understand how i figured it out. Well. I’ll give it a shot…
I will copy from my mysensors.json-file.
This particular node have the node id 78.
When i look in my mysensors.json-file i do it in terminal with nano.
This give me my file printer in one row.

Here it is formatted json-style
I have commented after #<— in the code below.

   "78":{  
      "protocol_version":"2.1.1",
      "sensor_id":78,
      "sketch_name":"Energy Meter",
      "children":{  
         "1":{  
            "values":{  
               "17":"1250" #<--- here i get Watt right now.
            },
            "id":1,
            "description":"",
            "type":13  #<--- this is the value type. 13 means S_POWER (WATT, KWH)
         },
         "2":{  
            "values":{  
               "18":"42.6160" #<--- here i get kwh over time
            },
            "id":2,
            "description":"",
            "type":13
         },
         "3":{  
            "values":{  
               "24":"42616" #<--- this is the pulse counter.
            },
            "id":3,
            "description":"",
            "type":23 #<--- value type S_CUSTOM
         }
      },
      "battery_level":0,
      "sketch_version":"1.0",
      "type":17
   }

If this should work, you need to copy my sketch in the link above so you get the right vaue type.
Try to use this and edit it to match your node id and node name.
Set all values to 0 or 1 to start from the beginning.
You should delete #— and the text after.

Here is from my mysensors.json-file unfromatted in just one line…

 "78": {"protocol_version": "2.1.1", "sensor_id": 78, "sketch_name": "Energy Meter", "children": {"1": {"values": {"17": "1250"}, "id": 1, "description": "", "type": 13}, "2": {"values": {"18": "42.6160"}, "id": 2, "description": "", "type": 13}, "3": {"values": {"24": "42616"}, "id": 3, "description": "", "type": 23}}, "battery_level": 0, "sketch_version": "1.0", "type": 17}}

Check this site to get all value types.

1 Like