No lights shown in GUI
-
Hi
I wanted to try out the lights via mysensors.
So from a switch sketch I've made a conversion to light sketch. The only change I've made is in present function have used S_DIMMER instead of S_BINARY. Other than that I am using the V_STATUS type to send the updates to HA.
So I can see that the persistence file has been populated with the sensors:
{"0": {"children": {}, "battery_level": 0, "protocol_version": "2.0.1-beta", "sketch_name": "SerialGateway", "sketch_version": "0.1", "sensor_id": 0, "type": 18}, "1": {"children": {"22": {"values": {}, "description": "IB_SALON_M_1", "id": 22, "type": 4}, "23": {"values": {}, "description": "IB_SALON_M_2", "id": 23, "type": 4}, "24": {"values": {}, "description": "IB_SALON_M_3", "id": 24, "type": 4}, "25": {"values": {}, "description": "IB_SALON_M_4", "id": 25, "type": 4}, "26": {"values": {"2": "0"}, "description": "IB_SALON_BL_1", "id": 26, "type": 4}, (...) }, "battery_level": 0, "protocol_version": "2.0.1-beta", "sketch_name": "InputBinary1", "sketch_version": null, "sensor_id": 1, "type": 17}}
but I am not getting anything shown in the GUI. Also I can see that the state requests (getting state from the HA when sketch initializes) are timing out.
So how do I get these lights properly populated? Maybe I am not aware of some obvious fact about light component.
on the side note, I have not seen any higher level explanation of the HA design. Is there something that explains its architecture?
-
None of the children have populated the
values
dictionary according to the JSON file. Initial values is required to add the mysensors devices as entities in home assistant and is explained in the mysensors docs at home-assistant.io.https://home-assistant.io/components/mysensors/#presentation
Please read the docs and use the provided example sketches at home-assistant.io when first trying a platform.
https://home-assistant.io/components/light.mysensors/#example-sketch
Note that this is a mysensors version 1.5 sketch.
-
Regarding architecture there's a developer section in the docs explaining that.
-
@martinhjelmare So do I need to send all 3 values to HA? As shown in the example sketch?
gw.send(lightMsg.set(currentLevel > 0 ? 1 : 0)); gw.send(dimmerMsg.set(currentLevel)); gw.send(rgbMsg.set(rgb));
Or will it be enough to send the lightMsg (that is V_STATUS)? And just as a sidenote - I have briefly checked the sketch in domoticz. It worked and I was able to turn on/off the lights and see the initial status.
-
The device will show in the HA GUI as soon as all required values comes in, but you should send an initial value for each V_TYPE that you want to use, otherwise some functions will probably not work. Check each platform doc for required types, S_TYPE and V_TYPE.
Edit: If you want more specific help, you should post serial and home assistant logs. It's hard for me to say anything specific for your case otherwise.
-
@martinhjelmare OK thanks. Will make sure to collect these logs next time. Hopefully I will get the console logs shown. Still not sure why I am not seeing them...
-
@martinhjelmare said:
The device will show in the HA GUI as soon as all required values comes in, but you should send an initial value for each V_TYPE that you want to use, otherwise some functions will probably not work. Check each platform doc for required types, S_TYPE and V_TYPE.
OK, after sending the V_PERCENTAGE it is visible. I have not understood correctly the table presented in the manual. Seems to be obvious now
However I am wondering how to get rid of the dimmer functionality on HA side. It could be done by sending e.g. V_PERCENTAGE == -1. That would tell the HA side the light is not a dimmer and we could get rid of such option for the lights in the front-end.
-
If you don't want it to be a dimmer then don't present it as a dimmer. What functionality do you need for the device? If it's only an on/off device you should present it as S_LIGHT or S_BINARY. Then it will show as a regular switch in the frontend.
-
@martinhjelmare But then can I have HA do the same stuff it is doing on other lights? https://home-assistant.io/components/light/ ?
-
Do you mean profiles and transition? Those are hardware specific features and not supported by mysensors lights.