home automation - Connecting MQTT server with OpenHab -


as sample test, want on/off bulb using openhab via wifi. connect hivemq server , openhab follows in openhab configuration.

mqtt:broker.url=tcp://127.0.0.1:1883 mqtt:broker.clientid=openhab 

so when starting openhab can see following in console.

2016-09-01 19:18:11.692 [info ] [.io.transport.mqtt.mqttservice] - mqtt service initialization completed. 2016-09-01 19:18:11.695 [info ] [o.i.t.m.i.mqttbrokerconnection] - starting mqtt broker connection 'broker' 2016-09-01 19:18:13.092 [info ] [penhab.io.rest.restapplication] - started rest api @ /rest 

so seems openhab , hivemq connected successfully. created following file on openhab distribution.

home.sitemap

sitemap home label="my house" {     frame label="esp module"{         group item=ff_bed label="front porch"     } } 

home.items

group group ggf       (all) group gff       (all)  group gf_living     "living room"   <video>     (ggf) group ff_bed        "bedroom"       <bedroom>   (gff)  dimmer light_gf_living_table        "table"         (gf_living, lights)     {mqtt="<[mybroker:/myhome/table:command:on]"} switch light_ff_bed_ceiling         "ceiling"       (ff_bed, lights)        {mqtt="<[mybroker:/myhome/doorbell:command:on]"}  /* locations */ location homelocation  myhome 

esp-pic.map

0=still 1=motion 

i can see above specified items on openhab site. when click on light there no updates mqtt server. can see following on openhab console.

2016-09-02 12:00:35.484 [info ] [runtime.busevents             ] - light_ff_bed_ceiling received command on 

so why doesn't publish change hivemq topic?

thanks.

you can have inbound or outbound mqtt messages in openhab.

your current configuration in home.items inbound because of "<"-sign. if want click on switch cause mqtt-message published broker, have change ">"-sign.

for reference have on page: https://github.com/openhab/openhab/wiki/mqtt-binding , search inbound or outbound messages


Comments