buxtronix / am43

Control AM43 blinds with an ESP32
MIT License
76 stars 25 forks source link

Position topic broken if device name is used #8

Closed Kite-Smurf closed 4 years ago

Kite-Smurf commented 4 years ago

I have just discovered that the position topic is broken, since the HA auto discovery function, if device name is used in the sensor config.

This does not update:

This works properly:

buxtronix commented 4 years ago

When auto-discovery is enabled, the topics use the mac address. This is to ensure uniqueness.

You should either disable auto-discovery in config.h, or remove the entries from configuration.yaml in HA.

buxtronix commented 4 years ago

I'd be interested in seeing the MQTT data being sent, particularly after a restart.

Both am43/# and homeassistant/# to see what it's sending for auto discovery.

The entity names should be the device name not mac (cover.kitchen_west for example)

Kite-Smurf commented 4 years ago

I need to correct my previous message. this is the result of the auto discovery:

image

The device name is used in the topic not the MAC. However the position topic is missing.

buxtronix commented 4 years ago

If auto-discovery is enabled, then the mac will be used in the topic. If auto-discovery is disabled, the topic will depend on the AM43_USE_NAME_FOR_TOPIC define.

Are you running from the latest commit?

Kite-Smurf commented 4 years ago

Yes, I'using the latest commit as the covers, battery sensors, light sensors were discovered automatically, except for the position. Position sensors never showed up. All (manually created) entities were removed from the covers.yaml and sensors.yaml.

This is what the MQTT explorer comes up with: (all these topics update regularly)

02bd8eb058b1 available = online position = 0 battery = 50 set = OPEN light = 48 02cc5aa4e276 available = online position = 0 battery = 67 set = OPEN light = 48 02874f1da497 available = online position = 1 set = OPEN battery = 47 light = 48

These seem to to be "old" retained topics. Not sure why they show up, but not updating:

Kitchen West position = 1 available = online LWT = Online battery = 96 position = 99 light = 51 available = online Dining North battery = 52 position = 0 light = 54 available = online Kitchen North battery = 93 position = 0 light = 54 available = online 02:bd:8e:b0:58:b1 available = offline battery = 96 position = 0 light = 54 02:87:4f:1d:a4:97 battery = 91 position = 100 light = 58

I hope this helps.

buxtronix commented 4 years ago

There wont be a separate position entity. This is contained within the cover itself. By clicking on the device name in the lovelace UI, the popup shows a slider for the position. HA doesnt show a separate entity for the position.

buxtronix commented 4 years ago

Example:

image

Kite-Smurf commented 4 years ago

Thanks for the info. I created the Position entities manually using the MAC in the topic and that seems to be working. image

We can close this then.