Hello energy bridgers! Thanks for figuring out the messages from the energy bridge, this is really neat. I’m having trouble getting it to work in home assistant with mosquitto. I think it’s an MQTT / home-assistant configuration issue somehow. This is the first thing I’m trying to do with home-assistant, so I’m sure it’s user error…
I tried the two methods listed by kidmock, thanks! It works directly from the bridge MQTT broker, Set up as the following in configuration.yaml, the dte sensor shows up and works. But, I assume this precludes using any other MQTT devices or mosquitto as the MQTT broker, so I think I want to make it work with mosquitto as the MQTT broker to ha.
# direct from the energy bridge, if that was the only MQTT thing in use, not likely, but it works.
mqtt:
broker: 192.168.15.19
port: 2883
client_id: home-assistant-1
username: admin
password: trinity
sensor:
# Main meter electrical flow courtesy DTE monopoly
- platform: mqtt
name: "DTE Energy Bridge"
state_topic: "event/metering/instantaneous_demand"
unit_of_measurement: 'W'
value_template: "{{ value_json.demand }}"
I am able to see data from it by manually subscribing from mosquitto, either from pc or from hassbian rpi. I can also publish and receive messages from command line. So I think mosquitto is working correctly. x.x.x.15 is hassbian, x.x.x.19 is the energy bridge, both are static assigned in the router. I also have home-assistant waiting for mosquitto service to be started first in /etc/systemd/system/[email protected]
pi@hassbian:~$ mosquitto_sub -h 192.168.15.19 -p 2883 -u admin -P trinity -t "event/metering/instantaneous_demand"
{"time":1558491026678,"demand":339}
{"time":1558491029718,"demand":339}
{"time":1558491032763,"demand":339}
{"time":1558491035807,"demand":341}
{"time":1558491038850,"demand":340}
But if I try to use mosquitto as the MQTT broker for home-assistant, like this: it does not work, the dte sensor does not show up in ha. ? Do I have the syntax correct for the connection section ? does this belong somewhere else besides in configuration.yaml? The configurator editor syntax checker suggested the semicolons be added.
mqtt:
broker: 192.168.15.15
port: 1883
clientid: homeassistant-1
username: pi
password: pimqtt
connection: dte
address: 192.168.15.19:2883
remote_username: admin
remote_password: trinity
try_private: false
start_type: automatic
topic: # both 0
sensor:
# Main meter electrical flow courtesy DTE monopoly
- platform: mqtt
name: "DTE Energy Bridge"
state_topic: "event/metering/instantaneous_demand"
unit_of_measurement: 'W'
value_template: "{{ value_json.demand }}"