stefanbode / Sonoff-Tasmota

Provide ESP8266 based itead Sonoff with Web, MQTT and OTA firmware using Arduino IDE, enhanced with I2C options
GNU General Public License v3.0
127 stars 41 forks source link

new cover management in home assistant #88

Closed madmicio closed 5 years ago

madmicio commented 5 years ago

hassio 0.82 introduces a new management of the cover. this is the suggested code

cover:

How can I implement this with your firmware?

stefanbode commented 5 years ago

I think example no2 in the wiki should do the job.

https://github.com/stefanbode/Sonoff-Tasmota/wiki/Shutter-blinds-working-with-two-relays

madmicio commented 5 years ago

no, unfortunately no! I think they changed so many things https://www.home-assistant.io/components/cover.mqtt/

stefanbode commented 5 years ago

Can you be more specific, what is not working as a command and what works. Open close position, reporting an so on. For me the second example looks promising to match with the requirements

madmicio commented 5 years ago

if I use this code:

cover:

I can move the shutter but I don't have the slider. and in the home assistant log I got this error:

2018-11-12 17:18:22 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'None' has no attribute 'attributes' 2018-11-12 17:18:26 WARNING (MainThread) [homeassistant.components.cover.mqtt] Payload is not True or False: 2018-11-12 17:18:28 WARNING (MainThread) [homeassistant.components.cover.mqtt] Payload is not True or False: 2018-11-12 17:18:32 WARNING (MainThread) [homeassistant.components.cover.mqtt] Payload is not True or False: 2018-11-12 17:18:34 WARNING (MainThread) [homeassistant.components.cover.mqtt] Payload is not True or False:

if I add this code: tilt_command_topic: 'cmnd/portafinestra/shutterposition' tilt_status_topic: 'cmnd/portafinestra/shutterposition' set_position_topic: 'cmnd/portafinestra/shutterposition' tilt_min: 0 tilt_max: 100 tilt_closed_value: 0 tilt_opened_value: 100

The result is: Testing configuration at /config Failed config cover.mqtt:

stefanbode commented 5 years ago

You should ask @b1g1 for help. Maybe there is an additional file missing for the template definition.

madmicio commented 5 years ago

it could be a good idea. but how do I send a message ???

B1G1 commented 5 years ago

Hi, i didn’t update to 0.82 yet, too many changes and i still running 0.79.3

madmicio commented 5 years ago
      Hi, i didn’t update to 0.82 yet, too many changes and i still running 0.79.3

exellent idea! is there the possibility to downgrade?

or now it's time to upgrade your home assistant :-)

B1G1 commented 5 years ago

I already downgraded from 0.80 to 0.79.3 because that version broke my configuration

You have to use ssh to run this command hassio homeassistant update --options “version=x.xx.x”

madmicio commented 5 years ago

ok just downgrade… all ok!

madmicio commented 5 years ago

for the moment I'm back to version 0.81.2 let me know if there are updates for the new version. thank you

bastshoes commented 5 years ago

For me new new mqtt.cover in HASS works fine. Here is my config:

- platform: mqtt
    name: "Balcony Blinds"
    availability_topic: "balconyblinds/tele/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    position_topic: balconyblinds/stat/SHUTTER1
    position_open: 100
    position_closed: 0
    set_position_topic: "balconyblinds/cmnd/shutterposition"
    value_template: "{{ value | int }}"
    command_topic: "balconyblinds/cmnd/backlog"
    payload_open: "SHUTTEROPEN"
    payload_close: "SHUTTERCLOSE"
    payload_stop: "SHUTTERSTOP"
    retain: false
    optimistic: false
    qos: 1
Sundown89 commented 5 years ago

For me new new mqtt.cover in HASS works fine. Here is my config:

- platform: mqtt
    name: "Balcony Blinds"
    availability_topic: "balconyblinds/tele/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"
    position_topic: balconyblinds/stat/SHUTTER1
    position_open: 100
    position_closed: 0
    set_position_topic: "balconyblinds/cmnd/shutterposition"
    value_template: "{{ value | int }}"
    command_topic: "balconyblinds/cmnd/backlog"
    payload_open: "SHUTTEROPEN"
    payload_close: "SHUTTERCLOSE"
    payload_stop: "SHUTTERSTOP"
    retain: false
    optimistic: false
    qos: 1

Changed my working mqtt config (thanks B1G1) to this one after upgrading from 0.79.x to 0.82.1 and all my shutters work perfectly! Thank you bastshoes!

bastshoes commented 5 years ago

According to new config in HASS state topic is not considered if position topic specified.

state_topic

    (string)(Optional)The MQTT topic subscribed to receive cover state messages. Use only if not using get_position_topic. State topic can only read open/close state. Cannot read position state.

position_topic

    (integer)(Optional)The MQTT topic subscribed to receive cover position messages. Always in favor if used together with state_topic.
madmicio commented 5 years ago

this code does not work for me. I do not understand why but it is so! I had to change it in:

Sundown89 commented 5 years ago

Take a look at your position_topic. Mine is: position_topic: screenr/stat/SHUTTER1 Yours starts with stat, maybe that's the problem.

madmicio commented 5 years ago

whit this code all works fine, the only problem is that after the restart I do not have the position until I move the shutter. it's normal?

platform: mqtt name: "salone" availability_topic: "tele/salone/LWT" payload_available: "Online" payload_not_available: "Offline" position_topic: stat/salone/SHUTTER1 position_open: 100 position_closed: 0 set_position_topic: "cmnd/salone/shutterposition" value_template: "{{ value | int }}" command_topic: "cmnd/salone/backlog" payload_open: "SHUTTEROPEN" payload_close: "SHUTTERCLOSE" payload_stop: "SHUTTERSTOP" retain: false optimistic: false qos: 1

bastshoes commented 5 years ago

Have you set 'power retain' in console for you shutter? HASS don't see previous messages if they do not have retain flag.

madmicio commented 5 years ago

ok… with powerretain works fine!

bastshoes commented 5 years ago

Added example to wiki. I guess issue can be closed.

titomontes commented 5 years ago

@stefanbode, can be closed.