Hi all,
I followed this instructions Yet another inexpensive Motion Sensor for Home Assistant - vCloudInfo on how to setup an ESP8266 running ESPEasy with a PIR sensor attached to it.
I´ve setup a binary_sensor in configuration.yaml:
binary_sensor: platform: mqtt state_topic: "NodeMCU4/Motion/Motion" name: "Office_Motion" payload_on: 1 payload_off: 0 device_class: motion
as well as a simple automation:
automation: - alias: 'Write file when motion happens' hide_entity: False initial_state: 'on' trigger: - platform: state entity_id: - binary_sensor.office_motion to: 'off' from: 'on' action: service: notify.test data: message: "Motion detected"
But nothing happens.
When I connnect via putty to the ESP, I see that everything should be good:
MQTT : Connected to broker Subscribed to: /NodeMCU4/# INIT : Cold Boot WD : Uptime 0 ConnectFailures 0 FreeMem 23760 config call:Motion SW : State 1 config call:Motion SW : State 0
Also the homeassistant log receives data from the ESP:
Dec 28 11:36:29 hassbian hass[12334]: 2017-12-28 11:36:29 DEBUG (MainThread) [hbmqtt.broker.plugins.packet_logger_plugin] mosqsub|18295-hassbian -out-> PublishPacket(ts=2017-12-28 11:36:29.070522, fixed=MQTTFixedHeader(length=26, flags=0x0), variable=PublishVariableHeader(topic=/NodeMCU4/Motion/Motion, packet_id=None), payload=PublishPayload(data="bytearray(b'1')")) Dec 28 11:36:31 hassbian hass[12334]: 2017-12-28 11:36:31 DEBUG (MainThread) [hbmqtt.broker.plugins.packet_logger_plugin] ESPClient1 <-in-- PublishPacket(ts=2017-12-28 11:36:31.771470, fixed=MQTTFixedHeader(length=26, flags=0x1), variable=PublishVariableHeader(topic=/NodeMCU4/Motion/Motion, packet_id=None), payload=PublishPayload(data="bytearray(b'0')"))
And when connecting via mosquitto_sub I also see the paylod 0 or 1:
/NodeMCU4/Motion/Motion 0 $SYS/broker/version HBMQTT version 0.9.1 /NodeMCU4/status Connection Lost /NodeMCU4/Motion/Motion 1 /NodeMCU4/Motion/Motion 0
So what am I missing here?
Many thanks,
Christian