Quantcast

Help with tie_items and mqtt

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Help with tie_items and mqtt

Craig Lindholm
Hello again.

I am learning how to use mqtt to send and receive information to and from MH.

I have in my items.mht file:

# MQTT stuff
CODE, require mqtt; #noloop

CODE, $smqtEntrance_Lights = new mqtt('smqtEntrance_Lights', '127.0.0.1', 1883, '/MH/Entrance/#', "", "", 122);
CODE, $pmqtEntrance_Lights = new mqtt_Item($smqtEntrance_Lights, "MH/Entrance/Light");
CODE, tie_items $Entrance_Lights $pmqtEntrance_Lights;


With this I can successfully send out the light status to the remote as shown in

01/14/17 11:23:17 *** mqtt mqtt_Item nom to MH to MQTT ($pmqtEntrance_Lights) no p_setby ::set($msg, $p_setby)
01/14/17 11:23:17 *** mqtt smqtEntrance_Lights check_for_data rcv'd: T:MH/Entrance/Light , M: on
01/14/17 11:23:17 *** mqtt smqtEntrance_Lights check_for_data rcv'd: S:Publish/at-most-once MH/Entrance/Light  6f 6e    on,
01/14/17 11:23:17 *** mqtt mqtt_Item nom to MQTT to MH $pmqtEntrance_Lights::set(on, mqtt=HASH(0x3028268))

when I manually turn on the light. The remote status is updated ....Great!

However if I toggle the item at the remote side, I get this:

01/14/17 11:26:08 *** mqtt smqtEntrance_Lights check_for_data rcv'd: T:MH/Entrance/Light , M: on
01/14/17 11:26:08 *** mqtt smqtEntrance_Lights check_for_data rcv'd: S:Publish/at-most-once MH/Entrance/Light  6f 6e    on,
01/14/17 11:26:08 *** mqtt mqtt_Item nom to MQTT to MH $pmqtEntrance_Lights::set(on, mqtt=HASH(0x3028268))

but nothing happens....the light doesn't switch.

If I change:
CODE, tie_items $Entrance_Lights $pmqtEntrance_Lights;

to this:

CODE, tie_items $Entrance_Lights $pmqtEntrance_Lights;
CODE, tie_items $pmqtEntrance_Lights $Entrance_Lights;

Then it works both ways....local and remote are synced and individually controllable.

This seems wrong though. if items are tied, then they should be tied both ways....should they not?

Am I doing something goofy?

Craig






------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users

Loading...