Change PT=1 to PT=0 when changing a sensor state.
-
Hello,
I recently jumped into the mysensors world and have the following set up so far:
D1 Mini as Gateway with NRF24L01+ and on board IR outputs (GatewayESP8266 + kakopappa Alexa Multi Switch + IR Mods)
Nano with NRF24L01+ as door locker (Just running the example version of RelayActuator for now)Currently, I'm running mycontroller so monitor states of things and also have loaded up Alexa control on my D1 Mini.
My IR outputs on my D1 Mini trigger an AC unit and a light, when I use Alexa they work and update the status of each on mysensors/mycontroller too.bool updateState(uint8_t SENSOR_ID, uint8_t STATE_VALUE){ MyMessage msg(SENSOR_ID, V_STATUS); send(msg.set(STATE_VALUE), false); }
However with my sensor/door locker it does work with Alexa but I cannot get it to update it's status.
bool changeState(uint8_t SENSOR_ID, uint8_t STATE_VALUE){ MyMessage msg(SENSOR_ID, V_STATUS); msg.setDestination(1); send(msg.set(STATE_VALUE)); }
The only difference between me triggering it from mycontroller and Alexa is the following:
Alexa trigger:
TSF:MSG:SEND,0-0-1-1,s=3,c=1,t=2,pt=1,l=1,sg=0,ft=0,st=OK:0
Mycontroller trigger:
TSF:MSG:SEND,0-0-1-1,s=3,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:0
Showing the only different variable that I can see is PT=0 vs PT=1.
How can I change the PT=1 to PT=0? Is that what is causing it to change but not update?Thanks!
-
HI,
I cannot answer your question but if you go to log parser you can see one is sending a string, the other is sending a byte.
Perhaps this will help.
John
-
@JohnRob
Thanks for the link! I modified the "byte" into a string and both received commands are identical but the sensor status on mycontroller still doesn't update (the button shows off even though it's on...).I'll keep digging!
Thanks!
-
@psteward your logs say that the same node (0) is the source in both cases, and the same node (1) is the destination. But from your description, the ac is controlled from the gateway (node 0) and the door is controlled from node 1. That doesn't add up. What am I missing?
-
I have the gateway (d1 mini) and the node/sensor (nano). The sensors attached locally update properly (d1 mini), but when I trigger the remote node/sensor (nano) it does not update the status when it runs the command.
To rephrase:
I trigger the remote sensor from the gateway via mycontroller and it works ---and the button on mycontroller shows an updated status of on (I did click it after all).
I trigger the remote sensor from the gateway via an Alexa function and it works ---and the button on mycontroller still shows off. (<---This is the problem, it doesn't change the status reflecting the change I made, even though it received the signal and made the pin output high with the same function that works via mycontroller!)
And:
I trigger a local sensor (on a pin of the gateway) from the gateway via an Alexa function and it works --- and the button on mycontroller shows an updated status of on.
-
@psteward thanks for clarifying.
So if I understand correctly, the non-Alexa path is controller->gateway->door-node, and the Alexa path is Alexa->gateway->door-node. The Alexa path does not update the controller? Is that correct?
If that's the case, the answer is simple: the controller is not involved in the Alexa path. Since the controller is not involved, it is not updated.
I think a possible solution is to let the door-node send it's status to the gateway whenever the door-node status is updated. See the loop in https://github.com/mysensors/MySensorsArduinoExamples/blob/master/examples/RelayWithButtonActuator/RelayWithButtonActuator.ino for an example.
But it could also be the case that I don't understand how your Alexa integration works.
-
Running the Alexa items directly on the gateway does update the controller, it's just the node/sensor that doesn't update.
When I execute the code through Alexa to trigger the sensor how can I force an update to the status as well?
Mycontroller thinks that I never executed the command (mymessage), and I have to send ON (via the interface) again to be able to turn it off, perhaps it's related to the savestate?
-
@psteward I don't know. I don't seem to be able to grasp the setup. Sorry.
But savestate is not related. It saves the value to eeprom on the node.
-
For a different approach, how would you manually force a sensor to change it's state (for a binary sensor) from the gateway?