How to update LIGHT state on Domoticz?
I want to send message to Domoticz to only update the state of the LIGHT without actually changing it.
So for example if my Light is ON and I reset my Arduino, the default state of the LIGHT is OFF but Domoticz knows the last state as ON, now I want my node to send a message to Domoticz and only update the state of the LIGHT to OFF.
I tried sending a message using send command and MyMessage but it doesn't work.
I have sent this type of message to Domoticz and it worked, but very slowly. You might just be giving up on it too soon. On my network it usually resets on Domoticz just when I am convinced it is not working and about ready to give up. I'll time it next time I have that node set up.
When clicking the button in Domoticz it turns the light on almost instantly. It is just when I want a message from the light to reset Domoticz that it is slow. Since it is just changing the screen to match what has already happened, it doesn't bother me in practice, only when I am testing and waiting on it.
@nagelc How did you do it?
This is not a very good example because it is using MySensors 1.5 and I have several buttons that I update at the same time so I am building a message on the fly:
msg.setSensor(btn[i]->childID); gw.send(msg.set(btn[i]->stateObject), true); // Send new state and request ack back
All this is doing is setting the child ID, setting the state (I'm calling a variable, but it is 1 for On), and the true at the end is for the ack. You don't really need the ack.
For MySensors 2.0 I think you do it this way:
If you have a message declared:
MyMessage lightMsg(CHILD_ID_LIGHT, V_LIGHT);
To send the status to the gateway:
send(lightMsg.set(1)); //1 for On or 0 for 0ff
I'm still moving over from MySensors 1.5 to 2.0, so I haven't tried this one yet.
@palande.vaibhav You can also "request()" the last state from domoticz (or another controller) Domoticz will than send you the current state.
If you send a message to Domoticz It will take a little while to show up on the dashboard. Domoticz updates the value immediately but calls the display update every x seconds.
@AWI how do I use request()?
What I need to do is my automation for the sensors is running on the Arduino itself. So, if domoticz stops working and then some values of the switches or lights change, I want Domoticz to display the same values not the values it had the last time.
I tried what @nagelc said but it changes the state of the switch in domoticz. I just want to update what domoticz displays not actually change the state of the LIGHT.
I read on Domoticz forum that this can be achieved using dummy switch which when set up as the slave for the actual switch only updates the displayed state of the switch. But this was discussed for JSON. I don't know how to make mysensors talk to the dummy node.
Do you have any idea about this?