Community Hass.io Add-on: AppDaemon 3

please next time show your code as code so we can see indention.
and what do you have in your dashboard file?

It was able to install flask. Only problem / error is with flask-assistant as mentioned in log content above.

Anyway i can have it installed. I am using hassio and there is nothing i can do or install outside hassio / homeassistant.

you might be able to install flask, but using flask(assistant) inside the appdaemon docker is in my idea not possible.
flask is a simular program as appdaemon is.
it is there to write apps and you use those apps to add things to a server.

apps for appdaemon and apps for flask are incompatible. a python script can only a flask app OR an appdaemon app, but not both.

so there is no use in trying to combine those 2 programs in 1 docker in my eyes (you may correct me if i am wrong)

even if it was possible, it still would not be possible inside hassio. flask works with a server that you want to be able to reach from outside the docker. the addon doesnt enable you to reach the flask server from outside, so you would need to change/recreate the addon.

Hi, sorry about that.
Here’ the formatted code:

log:
  accessfile: /config/appdaemon/logs/access.log
  logfile: /config/appdaemon/logs/appdaemon.log
  errorfile: /config/appdaemon/logs/error.log
  log_generations: 3
  log_size: 1000000
appdaemon:
  threads: 10
  app_dir: /config/appdaemon/apps
  plugins:
    HASS:
      type: hass
      ha_url: https://xyzxyz.xy:8123
      ha_key: xyzxyz
hadashboard:
  dash_url: http://192.168.1.12:5050
  dash_dir: /config/appdaemon/dashboards

Dashboard:

#
# Main arguments, all optional
#
title: Hovedpanel
widget_dimensions: [120, 120]
widget_margins: [5, 5]
columns: 8

gang_temperatur:
    widget_type: sensor
    title: Gangtemperatur
    units: "°C"
    precision: 0
    entity: sensor.multisensor_01_temperature

weather_widget:
    widget_type: weather
    units: "°C"

layout:
    - clock.clock(2x1), weather_widget(2x1)
    - gang_temperatur(2x1)
    - weather.weather(4x4)

i suspect that your url is giving a problem, or else that should work, what is in the logfile? (from the moment you strat appdaemon)

I’m very new to AppDaemon and Python, so i’ll begin with that. I am on HA 0.63.3

I’m trying to use AppDaemon to write an app that will allow me to listen to the event for when the cover_open service is called. Then I can use it to drive the GPIO pins with PWM for a DC motor. (i’m presenting at a booth at my local Salt Lake City Maker Faire with @DrZzs and we want to simulate the Garage Door cover but with a LEGO garage door).

When i try to add in the Python package for RPi.GPIO, i get this error in log:

[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: AppDaemon3 v0.1.0
 Python Apps and HADashboard using AppDaemon 3.x for Home Assistant
 From: Community Hass.io Add-ons
 By: Franck Nijhof <[email protected]>
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing... 
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 03-version-requirements.sh: executing... 
INFO: Supervisor version requirements checks passed.
[cont-init.d] 03-version-requirements.sh: exited 0.
[cont-init.d] 20-init-configuration.sh: executing... 
[cont-init.d] 20-init-configuration.sh: exited 0.
[cont-init.d] 21-compiled-dir.sh: executing... 
[cont-init.d] 21-compiled-dir.sh: exited 0.
[cont-init.d] 50-compiled-symlink.sh: executing... 
[cont-init.d] 50-compiled-symlink.sh: exited 0.
[cont-init.d] 80-system-packages.sh: executing... 
[cont-init.d] 80-system-packages.sh: exited 0.
[cont-init.d] 81-python-packages.sh: executing... 
Collecting RPi.GPIO
  Downloading RPi.GPIO-0.6.3.tar.gz
Installing collected packages: RPi.GPIO
  Running setup.py install for RPi.GPIO: started
    Running setup.py install for RPi.GPIO: finished with status 'error'
    Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lqpo_j7p/RPi.GPIO/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-d7p47z6u-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.6
    creating build/lib.linux-armv7l-3.6/RPi
    copying RPi/__init__.py -> build/lib.linux-armv7l-3.6/RPi
    creating build/lib.linux-armv7l-3.6/RPi/GPIO
    copying RPi/GPIO/__init__.py -> build/lib.linux-armv7l-3.6/RPi/GPIO
    running build_ext
    building 'RPi._GPIO' extension
    creating build/temp.linux-armv7l-3.6
    creating build/temp.linux-armv7l-3.6/source
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.6m -c source/py_gpio.c -o build/temp.linux-armv7l-3.6/source/py_gpio.o
    unable to execute 'gcc': No such file or directory
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lqpo_j7p/RPi.GPIO/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-d7p47z6u-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-lqpo_j7p/RPi.GPIO/
FATAL: Failed installing package RPi.GPIO
[cont-init.d] 81-python-packages.sh: exited 1.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 50-compiled-symlink.sh: executing... 
[cont-finish.d] 50-compiled-symlink.sh: exited 0.
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.
 
 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] syncing disks.
[s6-finish] sending all processes the TERM signal.  

Any ideas why? Is RPi.GPIO supported for AppDaemon and Hass.io? Or is there some other way I can control the Pi GPIO with PWM?

(I’ve looked at using the rpi_gpio_pwm component as a way, but current forum post confirmed that I also got error with HA and that component - How to use the PWM LED component in hassio)

thank you for any help or direction.

NOTE:
moved this to a separate topic on the forum - since it’s not really about AppDaemon3 anymore. More about how to use GPIO component within Hass.io addon - Addon to run Python Script that imports the RPi.GPIO component

Yes, I do of course!

Currently, I’m moving into my new house, so pretty limited in time. Hopefully, I am back at full speed next week.

2 Likes

@frenck - I’m getting ready to release b4 in the next short period of time, so give me a shout when you are making the addon if it’s before, so we can coordinate and have you go straight to b4 - there are no breaking changes so far.

4 Likes

@aimc I will ping you on Discord.

I’ve now updated the add-on for the 2.x branch, some of those things need to be ported to the 3.x branch add-on as well.

Hass.io has a new API security layer (not enforced yet) that needs to be supported in order to ensure the add-on keeps working in the future.

1 Like

Maybe i am wierd, but ha and hassio should be glad that there are programms like appdaemon that make it even better.
If hassio starts to make demands for other programs its a downhill slope.
If it goes on like this inthe future it will be
1)hassio with barebone ha or
2) homeassistant without hassio, but with a lot of other options.

@aimc, @frenck and @ReneTode I for one appreciate all of the work and time that you put in to make Home Assistant better (not meant to slight others).

When I get smart enough to help I will. If there is anything I can help with please ask.

I think that many are trying to make Hassio do everything that HA can do but not put any effort into it. That is a good expectation if you are paying for a program, but not for a free, open source program.

Thank you for your efforts.

3 Likes

Is the map_state supported on the sensor widget? I put the following definition for test and map_state doesn’t work but sub_entity_map does.

recu_special_mode:
  widget_type: sensor
  title: Rekuperator
  title2: Tryb pracy
  entity: sensor.rec_special_mode
  map_state:
    0: Harmonogram
    7: Wietrzenie
  sub_entity: sensor.rec_special_mode
  sub_entity_map:
    0: Harmonogram
    7: Wietrzenie

its state_map not map_state :wink:

:tada: Release v0.2.0

This release upgrades AppDaemon3 to v3.0.0 beta 4. It also adds support for the new security layer of Hass.io, in order to guarantee it keeps working now and in the future.

Full Changelog

Added

  • Warns the user when not using the Hass.io Proxy address
  • Adds support for auto configuring Hass.io API security key

Changed

  • Updates base image to v1.3.3
  • Optimizes images in this repository
  • Upgrades AppDaemon version to 3.0b4 (#7) (@acockburn)
3 Likes

Great, is the icon fixed?

No, I was only made aware of that issue this morning - it is fixed in the next version.

:tada: Release v0.3.0

Full Changelog

Changed

  • Updates AppDaemon to version 3.0.0b5 (#8) (@acockburn)

Rene, thanks for looking into it. My bad. I was trying both map_state and state_map and eventually pasted map_state config to the thread. None of them works anyway. The reason I was also trying map_state is because I saw somewhere in the code the property name self.map_state and wanted to try this one as well. No success so far. It looks like for sensor widget type, there is no map_state implemented at all. Funny, sub_entity_map works fine.

i did take a quick look in the code and it seems like that the sensor widget isnt the same as the others.
it seems that you can use “state_text” instead of “state_map”

@aimc if i am correct, then please change it in the code or in the docs

:tada: Release v1.0.0

First stable release containing the first AppDaemon 3.0.0 stable release!
Thanks to @aimc for all his hard work on this!

Full Changelog

Changed

  • Updates AppDaemon to version 3.0.0 (#9) (@acockburn)
2 Likes