├── .gitignore ├── README.md ├── apps ├── .gitignore ├── apps.yaml └── music_lights.py └── dashboards └── adams_room.dash /.gitignore: -------------------------------------------------------------------------------- 1 | appdaemon.yaml -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AppDaemon apps that run on my Home Assistant server 🏡 2 | 3 | ## Configuration 4 | 5 | - Hassio 2.8 6 | - Hassio AppDaemon addon using AppDaemon version 3 7 | 8 | To run these apps with the Hassio AppDaemon addon, you need to specify the following dependencies in your configuration: 9 | 10 | ```json 11 | "system_packages": [ 12 | "build-base", 13 | "python-dev python3-dev", 14 | "jpeg-dev", 15 | "zlib-dev", 16 | "freetype-dev", 17 | "lcms2-dev", 18 | "openjpeg-dev", 19 | "tiff-dev", 20 | "tk-dev", 21 | "tcl-dev", 22 | "harfbuzz-dev", 23 | "fribidi-dev" 24 | ], 25 | "python_packages": [ 26 | "colorthief" 27 | ] 28 | ``` 29 | 30 | ## Apps 31 | 32 | - [HADashboard](https://www.home-assistant.io/docs/ecosystem/hadashboard/) (my configurations are under `dashboards/`) 33 | - [Music Lights](https://github.com/astone123/appdaemon-apps/blob/master/apps/music_lights.py) 34 | -------------------------------------------------------------------------------- /apps/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ -------------------------------------------------------------------------------- /apps/apps.yaml: -------------------------------------------------------------------------------- 1 | ### App to sync my light strip color with my TV's Chromecast ### 2 | music_lights: 3 | module: music_lights 4 | class: music_lights 5 | ha_url: !secret ha_url 6 | media_player: "media_player.adams_tv" 7 | photo_attribute: "entity_picture" 8 | light: "light.yeelight_strip_7811dc66e295" 9 | -------------------------------------------------------------------------------- /apps/music_lights.py: -------------------------------------------------------------------------------- 1 | import appdaemon.plugins.hass.hassapi as hass 2 | import sys 3 | 4 | if sys.version_info < (3, 0): 5 | from urllib2 import urlopen 6 | else: 7 | from urllib.request import urlopen 8 | 9 | import io 10 | 11 | from colorthief import ColorThief 12 | 13 | # This script controls an RGB light entity color based on the photo attribute of a media player entity 14 | class music_lights(hass.Hass): 15 | 16 | def initialize(self): 17 | self.listen_state(self.change_led_color, self.args["media_player"], attribute = self.args["photo_attribute"]) 18 | 19 | def change_led_color(self, entity, attribute, old, new, kwargs): 20 | if new != old: 21 | rgb_color = self.get_color(self.args["ha_url"] + new) 22 | self.turn_on(self.args["light"], rgb_color=[rgb_color[0], rgb_color[1], rgb_color[2]]) 23 | 24 | def get_color(self, url): 25 | fd = urlopen(url) 26 | f = io.BytesIO(fd.read()) 27 | color_thief = ColorThief(f) 28 | return color_thief.get_color(quality=3) 29 | -------------------------------------------------------------------------------- /dashboards/adams_room.dash: -------------------------------------------------------------------------------- 1 | title: Adam's Room 2 | widget_dimensions: [120, 115] 3 | columns: 5 4 | 5 | clock: 6 | widget_type: clock 7 | 8 | box_fan: 9 | widget_type: switch 10 | title: Box Fan 11 | entity: switch.box_fan 12 | icon_on: fa-snowflake 13 | icon_off: fa-snowflake 14 | 15 | adams_tv: 16 | widget_type: media_player 17 | title: TV 18 | entity: media_player.adams_tv 19 | 20 | front_door: 21 | widget_type: binary_sensor 22 | title: Front Door 23 | entity: binary_sensor.front_door 24 | 25 | back_door: 26 | widget_type: binary_sensor 27 | title: Back Door 28 | entity: binary_sensor.back_door 29 | 30 | lights: 31 | widget_type: light 32 | title: Lights 33 | entity: light.adams_room 34 | 35 | room_temperature: 36 | widget_type: sensor 37 | title: Temperature 38 | units: "°F" 39 | entity: sensor.adam_s_room_real_feel 40 | 41 | layout: 42 | - front_door(1x1), back_door(1x1), lights(1x1), light.yeelight_strip_7811dc66e295, light.nanoleaf_aurora_51_b0_97_local 43 | - clock(2x1), adams_tv(3x1) 44 | - room_temperature(1x1), box_fan(1x1) 45 | --------------------------------------------------------------------------------