Hi All,
This is going to probably be a little long, but I want to explain what is happening in the hopes that it makes sense to someone nd they can direct me to what I can do to correct it. To start with, I am using esphomeyaml to program my sonoff devices which has been working really well up to now. My latest Device has been a simple Sonoff Basic with an added Microwave sensor added to the Other GPIO. I then set it all up in esphomeyaml using the name toilet_light_01. I have MQTT Discovery enabled in my configuration.yaml.
mqtt:
broker: 192.168.0.40
discovery: true
discovery_prefix: homeassistant
I’m running Mosquito on a separate dedicated VM
The esphomeyaml Config Looks like this…
esphomeyaml:
name: toilet_light_01
platform: ESP8266
board: esp01_1m
board_flash_mode: dout
wifi: !include inc/wifi.yaml
mqtt:
broker: !secret mqtt_broker
username: ''
password: ''
logger:
ota:
sensor:
- platform: wifi_signal
name: "Toilet Light 01 WiFi RSSI"
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
id: toilet_light_switch
filters:
- delayed_on: 30ms
- delayed_off: 30ms
on_press:
then:
- light.toggle: toilet_light
on_release:
then:
- light.toggle: toilet_light
- platform: status
name: "Toilet Light 01 Status"
- platform: gpio
pin: GPIO14
name: "Toilet Light 01 Motion"
device_class: motion
output:
- platform: gpio
pin: GPIO12
id: gpio_12
light:
- platform: binary
name: "Toilet Light 01"
output: gpio_12
id: toilet_light
status_led:
pin:
number: GPIO13
inverted: True
When HA found the device, it configured a Binary_sensor for the Motion, A Binary_Sensor for the Status and a Light for the Light Switch. It wouldnt see the Wifi RSSI Sensor. Then tried to add the MQTT RSSI Sensor manually in HA, and it would show up, but as unavailable.
I tried usng the Clean MQTT option in esphomeyaml and trying again, but with similar results.
Meantime, I had configured another Sonoff Basic using the same methodology for the Exhaust fan. This Worked fine.
As a last ditch effort, Ithen tried to rename the Device. So it became “wclight01”
I made the changes in the esphomeyaml config and tried again.
It now looks like this.
esphomeyaml:
name: wclight01
platform: ESP8266
board: esp01_1m
board_flash_mode: dout
wifi: !include inc/wifi.yaml
mqtt:
broker: !secret mqtt_broker
username: ''
password: ''
logger:
ota:
sensor:
- platform: wifi_signal
name: "WC Light 01 WiFi RSSI"
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
id: toilet_light_switch
filters:
- delayed_on: 30ms
- delayed_off: 30ms
on_press:
then:
- light.toggle: toilet_light
on_release:
then:
- light.toggle: toilet_light
- platform: status
name: "WC Light 01 Status"
- platform: gpio
pin: GPIO14
name: "WC Light 01 Motion"
device_class: motion
output:
- platform: gpio
pin: GPIO12
id: gpio_12
light:
- platform: binary
name: "WC Light 01"
output: gpio_12
id: toilet_light
status_led:
pin:
number: GPIO13
inverted: True
Now, I get the Status as
binary_sensor.wc_light_01_status on
friendly_name: WC Light 01 Status
device_class: connectivity
and the RSSI as
_sensor.toilet_light_01_rssi: -66 _
unit_of_measurement: dB
friendly_name: WC Light 01 WiFi RSSI
icon: mdi:wifi
Notice it still has the sensor name from the previous config
and now I dont have either the Motion Sensor “Binary_sensor” nor the Light Switch.
Now, on the MQTT server side, I see the Following in the HA logs
2018-12-12 21:02:57 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/wclight01/wc_light_01_wifi_rssi/config: b'{"unit_of_measurement":"dB","expire_after":675,"icon":"mdi:wifi","name":"WC Light 01 WiFi RSSI","state_topic":"wclight01/sensor/wc_light_01_wifi_rssi/state","availability_topic":"wclight01/status","unique_id":"dc4f2244f058-wifisignal","device":{"identifiers":"dc4f2244f058","name":"wclight01","sw_version":"esphomelib v1.9.3 Dec 11 2018, 21:31:52","model":"PLATFORMIO_ESP01_1M","manufacturer":"espressif"}}'
2018-12-12 21:02:57 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/binary_sensor/wclight01/wc_light_01_status/config: b'{"device_class":"connectivity","payload_on":"online","payload_off":"offline","name":"WC Light 01 Status","state_topic":"wclight01/status","unique_id":"ESPbinary_sensorwc_light_01_status","device":{"identifiers":"dc4f2244f058","name":"wclight01","sw_version":"esphomelib v1.9.3 Dec 11 2018, 21:31:52","model":"PLATFORMIO_ESP01_1M","manufacturer":"espressif"}}'
2018-12-12 21:02:57 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor wclight01 wc_light_01_wifi_rssi
2018-12-12 21:02:57 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: binary_sensor wclight01 wc_light_01_status
2018-12-12 21:03:00 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to wclight01/status
2018-12-12 21:03:00 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to wclight01/status
2018-12-12 21:03:00 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to wclight01/sensor/wc_light_01_wifi_rssi/state
2018-12-12 21:03:00 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on wclight01/status: b'online'
2018-12-12 21:03:00 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on wclight01/status: b'online'
2018-12-12 21:03:00 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on wclight01/sensor/wc_light_01_wifi_rssi/state: b'-66'
2018-12-12 21:03:11 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on wclight01/sensor/wc_light_01_wifi_rssi/state: b'-66'
and the mosquitto log.
1544615847: New client connected from 192.168.0.131 as wclight01-dc4f2244f058 (c1, k15).
1544615847: Sending CONNACK to wclight01-dc4f2244f058 (0, 0)
1544615847: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (48 bytes))
1544615847: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/status', ... (6 bytes))
1544615847: Sending PUBLISH to 964e655b-f6e0-4d57-bb83-e23a358a8e2a (d0, q0, r0, m0, 'wclight01/status', ... (6 bytes))
1544615847: Received SUBSCRIBE from wclight01-dc4f2244f058
1544615847: wclight01/light/wc_light_01/command (QoS 0)
1544615847: wclight01-dc4f2244f058 0 wclight01/light/wc_light_01/command
1544615847: Sending SUBACK to wclight01-dc4f2244f058
1544615847: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'homeassistant/sensor/wclight01/wc_light_01_wifi_rssi/config', ... (406 bytes))
1544615847: Sending PUBLISH to 964e655b-f6e0-4d57-bb83-e23a358a8e2a (d0, q0, r0, m0, 'homeassistant/sensor/wclight01/wc_light_01_wifi_rssi/config', ... (406 bytes))
1544615847: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/sensor/wc_light_01_wifi_rssi/state', ... (3 bytes))
1544615847: Sending PUBLISH to 964e655b-f6e0-4d57-bb83-e23a358a8e2a (d0, q0, r0, m0, 'wclight01/sensor/wc_light_01_wifi_rssi/state', ... (3 bytes))
1544615847: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'homeassistant/binary_sensor/wclight01/wc_light_01_status/config', ... (358 bytes))
1544615847: Sending PUBLISH to 964e655b-f6e0-4d57-bb83-e23a358a8e2a (d0, q0, r0, m0, 'homeassistant/binary_sensor/wclight01/wc_light_01_status/config', ... (358 bytes))
1544615847: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'homeassistant/binary_sensor/wclight01/wc_light_01_motion/config', ... (378 bytes))
1544615847: Sending PUBLISH to 964e655b-f6e0-4d57-bb83-e23a358a8e2a (d0, q0, r0, m0, 'homeassistant/binary_sensor/wclight01/wc_light_01_motion/config', ... (378 bytes))
1544615847: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/binary_sensor/wc_light_01_motion/state', ... (3 bytes))
1544615847: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (48 bytes))
1544615847: wclight01/status (QoS 0)
1544615847: 964e655b-f6e0-4d57-bb83-e23a358a8e2a 0 wclight01/status
1544615847: Sending PUBLISH to 964e655b-f6e0-4d57-bb83-e23a358a8e2a (d0, q0, r1, m0, 'wclight01/status', ... (6 bytes))
1544615847: wclight01/status (QoS 0)
1544615847: 964e655b-f6e0-4d57-bb83-e23a358a8e2a 0 wclight01/status
1544615847: Sending PUBLISH to 964e655b-f6e0-4d57-bb83-e23a358a8e2a (d0, q0, r1, m0, 'wclight01/status', ... (6 bytes))
1544615847: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/light/wc_light_01/state', ... (15 bytes))
1544615847: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (73 bytes))
1544615847: wclight01/binary_sensor/wc_light_01_motion/state (QoS 0)
1544615847: 964e655b-f6e0-4d57-bb83-e23a358a8e2a 0 wclight01/binary_sensor/wc_light_01_motion/state
1544615964: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (73 bytes))
1544615964: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/binary_sensor/wc_light_01_motion/state', ... (2 bytes))
1544615964: Sending PUBLISH to 964e655b-f6e0-4d57-bb83-e23a358a8e2a (d0, q0, r0, m0, 'wclight01/binary_sensor/wc_light_01_motion/state', ... (2 bytes))
1544615966: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (111 bytes))
1544615966: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/sensor/wc_light_01_wifi_rssi/state', ... (3 bytes))
1544615966: Sending PUBLISH to 964e655b-f6e0-4d57-bb83-e23a358a8e2a (d0, q0, r0, m0, 'wclight01/sensor/wc_light_01_wifi_rssi/state', ... (3 bytes))
1544615967: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (74 bytes))
1544615967: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (57 bytes))
1544615967: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/light/wc_light_01/state', ... (14 bytes))
1544615967: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (75 bytes))
1544615967: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (58 bytes))
1544615967: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/light/wc_light_01/state', ... (15 bytes))
1544615968: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (74 bytes))
1544615968: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (57 bytes))
1544615968: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/light/wc_light_01/state', ... (14 bytes))
1544615968: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (75 bytes))
1544615968: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (58 bytes))
1544615968: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/light/wc_light_01/state', ... (15 bytes))
1544615972: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r0, m0, 'wclight01/debug', ... (74 bytes))
1544615972: Received PUBLISH from wclight01-dc4f2244f058 (d0, q0, r1, m0, 'wclight01/binary_sensor/wc_light_01_motion/state', ... (3 bytes))
1544615972: Sending PUBLISH to 964e655b-f6e0-4d57-bb83-e23a358a8e2a (d0, q0, r0, m0, 'wclight01/binary_sensor/wc_light_01_motion/state', ... (3 bytes))
1544615975: Received PINGREQ from wclight01-dc4f2244f058
1544615975: Sending PINGRESP to wclight01-dc4f2244f058
1544615985: Received PINGREQ from wclight01-dc4f2244f058
1544615985: Sending PINGRESP to wclight01-dc4f2244f058
1544615996: Received PINGREQ from wclight01-dc4f2244f058
Looking at bthe log, Its like HA has only subscribed to some of the topics for the device, not all.
Anyone have any idea’s what is going on?
Should I just wipe my MQTT server config and start again?
Or is it somehting to do with how HA does its discovery?
SOrry for the long Post, but I needed to give you all the info and maybe someone will spot where I went wrong