Relay shows up in mysensors.json but not in gui [homeassistant]
-
From my limited use with sensors other then temperature, sometimes items don't appear in the GUI on Home Assistant until they send some data.
Also check in the States section of Developer Tools at what data HA has acquired from your sensor.
Beyond that, you might have to ask on the Home Assistant forums.
-
So I too was having this issue and pulling my hair out trying to understand what was wrong.
The homeassistant/mysensor doc page says you have to send intial values, but the important nuanced point is that ALL possible value types must have an initial value sent for a given sensor type.In my example, I could not figure out why my motion sensor (S_MOTION) was not registering in HA UI - I was sending an initial (V_TRIPPED) state.
However, S_MOTION sensors can have both V_TRIPPED and V_ARMED.
ref: https://www.mysensors.org/download/serial_api_20#presentation
Once I sent an initial value for V_ARMED, it started working - whew!So check carefully that you are sending some initial value for EVERY possible value type of your sensor type.
-
So I too was having this issue and pulling my hair out trying to understand what was wrong.
The homeassistant/mysensor doc page says you have to send intial values, but the important nuanced point is that ALL possible value types must have an initial value sent for a given sensor type.In my example, I could not figure out why my motion sensor (S_MOTION) was not registering in HA UI - I was sending an initial (V_TRIPPED) state.
However, S_MOTION sensors can have both V_TRIPPED and V_ARMED.
ref: https://www.mysensors.org/download/serial_api_20#presentation
Once I sent an initial value for V_ARMED, it started working - whew!So check carefully that you are sending some initial value for EVERY possible value type of your sensor type.
@jens-jensen thank you for your input
could you have a look at my sketch above and point me in the right direction on what needs to be changed/added?
I see this part which looks good to me:MyMessage flowMsg(CHILD_ID,V_FLOW); MyMessage volumeMsg(CHILD_ID,V_VOLUME); MyMessage lastCounterMsg(CHILD_ID,V_VAR1);``` thanks -
@jens-jensen thank you for your input
could you have a look at my sketch above and point me in the right direction on what needs to be changed/added?
I see this part which looks good to me:MyMessage flowMsg(CHILD_ID,V_FLOW); MyMessage volumeMsg(CHILD_ID,V_VOLUME); MyMessage lastCounterMsg(CHILD_ID,V_VAR1);``` thanks@bereska
looks mostly correct, althought I would take a look at the example here to use their technique for ensuring you send initial values for V_FLOW and V_VOLUME.
ref: https://www.home-assistant.io/components/mysensors/From your sketch, it seems possible that either may not be sent right away, e.g. if volume or flow is not changing, etc.
Also, where in HA UI are you looking? I had to add my sensor to one of my lovelace cards. Still getting the hang of the new UI (but definitely better than it was before). I also saw it in
developer,statesunder current entities -
@bereska
looks mostly correct, althought I would take a look at the example here to use their technique for ensuring you send initial values for V_FLOW and V_VOLUME.
ref: https://www.home-assistant.io/components/mysensors/From your sketch, it seems possible that either may not be sent right away, e.g. if volume or flow is not changing, etc.
Also, where in HA UI are you looking? I had to add my sensor to one of my lovelace cards. Still getting the hang of the new UI (but definitely better than it was before). I also saw it in
developer,statesunder current entities@jens-jensen thank you, like you said the sketch looks ok. Yet this only sensor fails to appear in HA, neither on dashboard nor in states or unused entities. The only thing I have noticed though is that this sketch is missing this part:
Bounce debouncer = Bounce(); bool state = false; bool initialValueSent = false;maybe that's the key to this problem?
-
@jens-jensen thank you, like you said the sketch looks ok. Yet this only sensor fails to appear in HA, neither on dashboard nor in states or unused entities. The only thing I have noticed though is that this sketch is missing this part:
Bounce debouncer = Bounce(); bool state = false; bool initialValueSent = false;maybe that's the key to this problem?
this is HA log:
2019-07-04 23:24:05 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on mygateway1-out/6/255/3/0/11: b'Water Meter',
2019-07-04 23:24:05 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 6;255;3;0;11;Water Meter,
2019-07-04 23:24:23 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on mygateway1-out/6/255/3/0/11: b'Water Meter',
2019-07-04 23:24:23 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 6;255;3;0;11;Water Meter -
Looking at your HA log, do you see that both V_FLOW and V_VOLUME values are sent after some time?
With the sketch, their idea is that you use
initialValueSentto send initial values (for all types) only once (at first boot) in loop section. -
Looking at your HA log, do you see that both V_FLOW and V_VOLUME values are sent after some time?
With the sketch, their idea is that you use
initialValueSentto send initial values (for all types) only once (at first boot) in loop section.@jens-jensen said in Relay shows up in mysensors.json but not in gui [homeassistant]:
V_FLOW and V_VOLUME values are sent after some time
no, V_FLOW and V_VOLUME values are NOT sent after some time
how to i modify the sketch to make it happen? -
@jens-jensen said in Relay shows up in mysensors.json but not in gui [homeassistant]:
V_FLOW and V_VOLUME values are sent after some time
no, V_FLOW and V_VOLUME values are NOT sent after some time
how to i modify the sketch to make it happen?@bereska
look at how the reference sketch in the homeassistant mysensors page works.
I starts with a boolinitialValueSentset to false.
It checks for this in loop, and if not already set to true, it will send initial values, then set initialValueSent = false, so that it never runs again (until sensor is restarted).Also regarding your sketch logic, should it periodically send values of all sensors (like at least once per hour, per day, etc)? You may want to look at that as well.
-
ok, I think i have also may have found a bug in the HA mysensors implementation, i.e. if you name your sketch with some reserved names, it never registers in HA.
I.e.
sendSketchInfo("motion_sensor", "1.0");won't work in HA
butsendSketchInfo("motion_sensor_foo", "1.0");shows up :(
I didn't see any mention of this in https://www.home-assistant.io/components/mysensors/
Maybe it's a bug (should mysensors ha component rename it or prefix with some namespace, etc; or should this be documented in guide - and then what are the reserved names which we cannot name sketches to?) -
nm, I seems like it eventually sends the sketch name
-
nm, I seems like it eventually sends the sketch name
@jens-jensen it does send and register the name, no problem.