meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
home_automation:home_assistant:appdaemon [2023/11/25 14:34] niziak |
home_automation:home_assistant:appdaemon [2023/12/11 17:23] (current) niziak |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== appdaemon ====== | ====== appdaemon ====== | ||
+ | |||
+ | Components: | ||
+ | * [[https://github.com/AppDaemon/appdaemon|AppDaemon]] | ||
+ | * [[https://github.com/hassio-addons/addon-appdaemon|Home Assistant Community Add-on: AppDaemon]] | ||
+ | * AppDaemon version pinning here: https://github.com/hassio-addons/addon-appdaemon/blob/main/appdaemon/requirements.txt | ||
+ | |||
Within release v0.15.0 the appdaemon data folder will migrate/move out of the Home Assistant configuration folder into a dedicated folder for this add-on. | Within release v0.15.0 the appdaemon data folder will migrate/move out of the Home Assistant configuration folder into a dedicated folder for this add-on. | ||
Line 6: | Line 12: | ||
[[https://github.com/hassio-addons/repository/blob/401642acf8b6be38c8c193fc8c5c9e2d512e9046/appdaemon/CHANGELOG.md|CHANGELOG]] | [[https://github.com/hassio-addons/repository/blob/401642acf8b6be38c8c193fc8c5c9e2d512e9046/appdaemon/CHANGELOG.md|CHANGELOG]] | ||
+ | |||
+ | Admin dashboard is available on [[http://hassio:5050/]] | ||
+ | |||
+ | ===== complex mutli-class apps ===== | ||
+ | |||
+ | Direct imports of classes defined in another file doesn't work. | ||
+ | Possible solutions: | ||
+ | - put all class in main app file | ||
+ | - use global module [[https://appdaemon.readthedocs.io/en/latest/APPGUIDE.html#global-module-dependencies | ||
+ | - do it in right way [[https://appdaemon.readthedocs.io/en/latest/APPGUIDE.html#app-dependencies|app-dependencies]] | ||
+ | - create more small apps | ||
+ | - make main app depend on them | ||
+ | - get access to other apps using [[https://appdaemon.readthedocs.io/en/3.0.4/AD_API_REFERENCE.html#get-app|get_app()]] | ||
+ | |||
+ | ===== create sensors ===== | ||
+ | |||
+ | With first call to ''set_state'' sensor will be created in HA. | ||
+ | |||
+ | |||
+ | ===== weather sensors ===== | ||
+ | |||
+ | Access as ''sensor'': | ||
+ | <code python> | ||
+ | wind = self.get_state("sensor.openweathermap_wind_speed") | ||
+ | temp = self.get_state("sensor.openweathermap_feels_like_temperature") | ||
+ | </code> | ||
+ | |||
+ | Access as ''weather'': | ||
+ | <code python> | ||
+ | WEATHER_SENSOR="weather.openweathermap" | ||
+ | temp = self.get_state(WEATHER_SENSOR, attribute="temperature") | ||
+ | tempa = self.get_state(WEATHER_SENSOR, attribute="apparent_temperature") | ||
+ | wind = self.get_state(WEATHER_SENSOR, attribute="wind_speed") | ||
+ | |||
+ | forecast = self.get_state(WEATHER_SENSOR, attribute="forecast") | ||
+ | for f in forecast: | ||
+ | self.log("forecast: %s %s", f["datetime"], f["temperature"]) | ||
+ | </code> | ||