MQTT: Difference between revisions

From base48
imported>Squirrel
No edit summary
imported>Squirrel
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:


ESP8266 starts and tries to connect to the broker. If that does not happen, blue light is ON.
ESP8266 starts and tries to connect to the broker. If that does not happen, blue light is ON.
Proper 'way' of using it, is than: "mosquitto_sub -v -t '/info'" to subscrib to info topic.
 
Executing " mosquitto_pub -t '/info/send' -m '1'" to initiate sending of informations.
Only important topic should be /info/send, you can send three strings now: desc, hp or ctl
each than responds to correspondic topic with adequate information, each device should listen for "/info/send" and act accordingly


This outputs something like:
This outputs something like:


  <nowiki>
  <nowiki>
/info pub,button,/workroom/buttons/table,sends char 1 when pressed
>>/info/send desc
/info sub,light,/workroom/lights/table_a,Send char of 0 or 1 to turn off or on
/info/desc esplana:ESP8266 in main workroom replaced svetlana, buggy az hellz
/info sub,light,/workroom/lights/table_b,Send char of 0 or 1 to turn off or on
 
>>/info/send hp
/info/hp esplana:flash id, 1458400
/info/hp esplana:cpu freq, 80000000
/info/hp esplana:unique id, b'\xae$\x19\x00'
/info/hp esplana:mem alloc, 17984
/info/hp esplana:mem gree, 18224
/info/hp esplana:statvfs, 4096,4096,869,858,858,0,0,0,0,255
 
>>/info/send ctl
/info/ctl esplana:pub,button,/workroom/buttons/table,sends char 1 when pressed
/info/ctl esplana:sub,light,/workroom/lights/ctl/table_a,Send char of 0 or 1 to turn off or on
/info/ctl esplana:pub,light,/workroom/lights/events/table_a,Sned char of 0 or 1 when light tunerd off or on
/info/ctl esplana:sub,light,/workroom/lights/ctl/table_b,Send char of 0 or 1 to turn off or on
/info/ctl esplana:pub,light,/workroom/lights/events/table_b,Sned char of 0 or 1 when light tunerd off or on
 
# button was pressed
/workroom/buttons/table 1
/workroom/buttons/table 1
 
  </nowiki>
  </nowiki>


TODO:
TODO:
* logging into mqtt
* keep alive check against device
* resolved DNS bug on esp8266 in workroom
* resolved DNS bug on esp8266 in workroom
* make it secure (open now)
* make it secure (open now)

Latest revision as of 16:16, 25 January 2017

Info

For now, there is installed broker mosquitto at mqtt.base48.cz. Only working device are lights at working table. repository

ESP8266 starts and tries to connect to the broker. If that does not happen, blue light is ON.

Only important topic should be /info/send, you can send three strings now: desc, hp or ctl each than responds to correspondic topic with adequate information, each device should listen for "/info/send" and act accordingly

This outputs something like:

>>/info/send desc
/info/desc esplana:ESP8266 in main workroom replaced svetlana, buggy az hellz

>>/info/send hp
/info/hp esplana:flash id, 1458400
/info/hp esplana:cpu freq, 80000000
/info/hp esplana:unique id, b'\xae$\x19\x00'
/info/hp esplana:mem alloc, 17984
/info/hp esplana:mem gree, 18224
/info/hp esplana:statvfs, 4096,4096,869,858,858,0,0,0,0,255

>>/info/send ctl
/info/ctl esplana:pub,button,/workroom/buttons/table,sends char 1 when pressed
/info/ctl esplana:sub,light,/workroom/lights/ctl/table_a,Send char of 0 or 1 to turn off or on
/info/ctl esplana:pub,light,/workroom/lights/events/table_a,Sned char of 0 or 1 when light tunerd off or on
/info/ctl esplana:sub,light,/workroom/lights/ctl/table_b,Send char of 0 or 1 to turn off or on
/info/ctl esplana:pub,light,/workroom/lights/events/table_b,Sned char of 0 or 1 when light tunerd off or on

# button was pressed
/workroom/buttons/table 1
/workroom/buttons/table 1

 

TODO:

  • logging into mqtt
  • keep alive check against device
  • resolved DNS bug on esp8266 in workroom
  • make it secure (open now)