Hi. I have test config for my garage door:
test_garage_door:
device_class: garage
unique_id: garagedoor
friendly_name: "Test Garage Door"
open_cover:
close_cover:
stop_cover:
and AppDaemon app:
import appdaemon.plugins.hass.hassapi as hass
##############################################
### ПОМЕНЯТЬ ПЕРЕМЕННЫЕ ТУТ
##############################################
# имя датчика открытых ворот OpenSensor
OS = "sensor.test_open"
# имя датчика закрытых ворот ClosedSensor
CS = "sensor.test_close"
# имя самих ворот
GATE = "cover.test_garage_door"
# имя ворот, отображаемых в интерфейсе ХА
GATEFNAME = "Test Garage Door"
class garage_door_status(hass.Hass):
def initialize(self):
handle = None
# слушем изменение датчиков открытых и закрытых ворот и если оно есть, запускаем функцию garage_door_status
self.listen_state(self.garage_door_status, OS, attribute="all")
self.listen_state(self.garage_door_status, CS, attribute="all")
#self.log(f'current state open sensor {last_open_sensor}')
#self.log(f'current state close sensor {last_close_sensor}')
def garage_door_status(self, entity, attribute, old, new, kwargs):
if old["state"]:
# немного тестирования статуса false
self.log(f'=====.input new state is {new["state"]}. old state is {old["state"]}')
if new["state"] == "off":
if entity == OS:
self.log("info 11. set gate staus to open")
self.set_state(GATE, state="open", attributes={"friendly_name": GATEFNAME, "supported_features": "11", "device_class": "garage"})
elif entity == CS:
self.log("info 12. set gate staus to closed")
self.set_state(GATE, state="closed", attributes={"friendly_name": GATEFNAME, "supported_features": "11", "device_class": "garage"})
if old["state"] == "off" and new["state"] == "on":
if entity == OS:
self.log("info 13. set gate staus to closing")
self.set_state(GATE, state="closing", attributes={"friendly_name": GATEFNAME, "supported_features": "11", "device_class": "garage"})
elif entity == CS:
self.log("info 14. set gate staus to opening")
self.set_state(GATE, state="opening", attributes={"friendly_name": GATEFNAME, "supported_features": "11", "device_class": "garage"})
The point is - depends on sensor trigered (i have 2 sensors - gate open and gate closed), gate state changes to open, close, opening closing. It work fine, until i was try to use google assistant to open garage door - google can not find entity. I was try some steps, andfind out:
- reload template in HA.
- ok google, update my devices. I can see garage door cover in google home android app.
- ok google, open test garage door - work fine. Try to chage cover.test_garage_door to open/closed state in development panel - work fine. Google assistant work after too.
- I use app using code above.
5 ok google, update my devices. I can not see my garage door, its gone
What i wad do wrong? Maybe appdaemon change some attributes in cover entities? Can some one point me to logs to view?