dawidchyrzynski / arduino-home-assistant

ArduinoHA allows to integrate an Arduino/ESP based device with Home Assistant using MQTT.
https://dawidchyrzynski.github.io/arduino-home-assistant/
GNU Affero General Public License v3.0
480 stars 116 forks source link

Slider support for cover #184

Open shotreal opened 1 year ago

shotreal commented 1 year ago

Simply making you aware of the extension i made, may be it can be of use. If not ignore my pr. Nice and clear code btw :)

I needed a slider support. (as some others also requested i think) I included a command topic "set_position_topic" as documented here https://www.home-assistant.io/integrations/cover.mqtt/ the topic is only "activated" for HACover::PositionFeature I introduced a new callback to get the slider values back. Borrowed from your HANumber implementation. You might want to check that part.

I have not checked if this value also needs to/ can be feed back to HA, yet (Like you do with the number slider, because i think cover gets that information from the "position_topic") I'm just happy that it works! I have not written any test cases to verify my code, yet. May be i do.

erdeidominik99 commented 10 months ago

Hello! @shotreal Thank you for the code, it works great, can you help me, how to add the position_open and position_closed parameters? By default the open is 100% and the closed is 0%, but I need the opposite (open 0% close 100%).