I’m adding a new mqtt sensor and I’m stuck on getting a value from what’s published. All I get is unknown.
Vera MQTT publishes this:
MQTT Last Message:{"Payload":"{\"DeviceId\":7,\"DeviceName\":\"smartmeter\",\"DeviceType\":\"urn:schemas-smartmeter-han:device:SmartMeterHAN1:1\",\"OldWatts\":911,\"RoomId\":1,\"RoomName\":\"House\",\"ServiceId\":\"urn:micasaverde-com:serviceId:EnergyMetering1\",\"Time\":1481661475,\"Variable\":\"Watts\",\"Watts\":929}","Topic":"Vera/Events/smartmeter"}
Here is my sensor:
- platform: mqtt
state_topic: “Vera/+/smartmeter/#”
name: “Smart Meter”
unit_of_measurement: “Watts”
value_template: “{{ value_json.watts }}”
My HA logs show this:
16-12-13 12:31:22 homeassistant.core: Bus:Handling <Event mqtt_message_received[L]: payload={"DeviceId":7,"DeviceName":"smartmeter","DeviceType":"urn:schemas-smartmeter-han:device:SmartMeterHAN1:1","OldWatts":652,"RoomId":1,"RoomName":"House","ServiceId":"urn:micasaverde-com:serviceId:EnergyMetering1","Time":1481661082,"Variable":"Watts","Watts":647}, qos=0, topic=Vera/Events/smartmeter>