Heaty will die, Schedy be born!

I had to completely reinstall my HA system (sadly). I am trying to install the hass-apps in a docker environment. I tried the requirements.txt method, but AppDaemon seemed to ignore it. On an off chance I added it to the config as so…

{
  "log_level": "info",
  "system_packages": [],
  "python_packages": [
    "hass-apps"
  ]
}

AppDaemon installed the python packages but (I suspect) because of this (below) it is not the version with schedy in:

Any chance of a release with Schedy in so installing is as easy as adding to the AppDaemon config? Manually installing in Docker is a pain that I do not want to go through…

Cheers

@baz123 The requirements.txt method works for AppDaemon >= 3.0.2. Verify you have this version installed and retry. There won’t be an official Schedy release soon as I want to get all moving parts settled first.

Thanks. Pretty sure I am on the right one - says release V1.6.0 (and I installed it from the store).

Either way, cannot use it until it is released.

Cheers

@baz123 I can’t understand what issue you actually have. Have you followed the getting started guide from the latest docs? https://hass-apps.readthedocs.io/en/latest/getting-started.html

EDIT:
And a log of the add-on start with the requirements.txt file in place would be helpful. Please remove hass-apps from the python_packages setting first.

Using installation in a docker instructions

with hass-apps in a requirements.txt file (created via Samba so I wonder about permissions) I get the following log on startup…

LOG with requirements text

-----------------------------------------------------------
 Hass.io Add-on: AppDaemon v1.6.0

 Python Apps and HADashboard using AppDaemon 3.x for Home Assistant

 From: Community Hass.io Add-ons
 By: Franck Nijhof <[email protected]>
-----------------------------------------------------------
 amd64 / Debian GNU/Linux 9 (stretch) / HA 0.82.1 / SU 139 / stable
-----------------------------------------------------------
[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] 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] 30-auto-token.sh: executing... 
INFO: Updating Hass.io API token in AppDaemon with the current one...
[cont-init.d] 30-auto-token.sh: exited 0.
[cont-init.d] 31-ha-url.sh: executing... 
[cont-init.d] 31-ha-url.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... 
[cont-init.d] 81-python-packages.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2018-11-18 18:53:14.026028 INFO AppDaemon Version 3.0.2 starting
2018-11-18 18:53:14.026655 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2018-11-18 18:53:14.034256 INFO AppDaemon: Starting Apps
2018-11-18 18:53:14.042429 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-11-18 18:53:14.539289 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-11-18 18:53:14.540212 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-11-18 18:53:14.540717 INFO Starting Dashboards
2018-11-18 18:53:14.574667 INFO API is disabled
2018-11-18 18:53:14.628175 INFO AppDaemon: HASS: Connected to Home Assistant 0.82.1
2018-11-18 18:53:14.854236 INFO AppDaemon: Got initial state from namespace default
2018-11-18 18:53:16.740577 INFO AppDaemon: Reading config
2018-11-18 18:53:16.797889 INFO AppDaemon: /config/appdaemon/apps/schedy.yaml added or modified
2018-11-18 18:53:16.798437 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2018-11-18 18:53:16.798694 INFO AppDaemon: /config/appdaemon/apps/schedy.yaml added or modified
2018-11-18 18:53:16.798901 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2018-11-18 18:53:16.799086 INFO AppDaemon: App 'schedy' added
2018-11-18 18:53:16.799295 INFO AppDaemon: App 'hello_world' added
2018-11-18 18:53:16.799590 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2018-11-18 18:53:16.800258 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hass_apps_loader.py
2018-11-18 18:53:16.806953 WARNING AppDaemon: ------------------------------------------------------------
2018-11-18 18:53:16.807514 WARNING AppDaemon: Unexpected error loading module: /config/appdaemon/apps/hass_apps_loader.py:
2018-11-18 18:53:16.807710 WARNING AppDaemon: ------------------------------------------------------------
2018-11-18 18:53:16.853065 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 2026, in check_app_updates
    self.read_app(mod["name"], mod["reload"])
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 1809, in read_app
    self.modules[module_name] = importlib.import_module(module_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/appdaemon/apps/hass_apps_loader.py", line 3, in <module>
    from hass_apps.loader import *
ModuleNotFoundError: No module named 'hass_apps'

2018-11-18 18:53:16.853439 WARNING AppDaemon: ------------------------------------------------------------
2018-11-18 18:53:16.853670 WARNING AppDaemon: Removing associated apps:
2018-11-18 18:53:16.854118 WARNING AppDaemon: schedy
2018-11-18 18:53:16.854377 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2018-11-18 18:53:16.921043 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2018-11-18 18:53:17.028939 INFO hello_world: Hello from AppDaemon
2018-11-18 18:53:17.030543 INFO hello_world: You are now ready to run Apps!
2018-11-18 18:53:17.031957 INFO AppDaemon: App initialization complete
2018-11-18 18:53:17.193501 INFO HADashboard: New dashboard connected: Main Panel

With the hass-apps in the python-packages it just complains that it cannot find Schedy (as I would expect).

However
If I add the github URL to the python-packages config as below…

{
  "log_level": "info",
  "system_packages": [],
  "python_packages": [
    "https://github.com/efficiosoft/hass-apps/archive/master.zip"
  ]
}

AppDaemon loads the package!!

A simple configuration later and I am in business.

schedy:
  module: hass_apps_loader
  class: SchedyApp
  actor_type: thermostat
  rooms:
    masterbedroom:
      schedule:
      - value: 25
        start: "05:30"
        end: "19:30"
        name: Fancy Rule
      - value: 14
      actors:
        climate.masterbedroom:

This really is a great addition to HA. No idea why the requirements.txt is not working for me but Schedy is working :smile:.

1 Like

@baz123 Oh, that add-on is not using the official AppDaemon container, so no requirements.txt support built-in. I’m just using it on plain docker with the image from acockburn and that works great. I’ll have to update the docs to reflect this… would have been to great if they just used the official container.

Good to hear that you’ve got Schedy working!

Ok so that has lost me (and maybe others who follow)!!! I simply followed these instructions to create a docker version of hassio (on a DietPi base OS), then went to Hassio and installed the AppDaemon addon from there.

Is this a Home Assistant v ‘Hass.io’ difference (which I do not understand)?

There is an official docker image for AppDaemon that is completely unrelated to hassio. That image has the requirements.txt support built-in.

The hassio add-on is not based on this official image, that’s why it didn’t work.

2 Likes

i get the feeling that you hit the point there.
so lets make that clear.

hassio is an operating system like linux or windows
home assistant is a program like microsoft word or open office
an addon is a piece off code that makes it possible to use an existing program (like appdaemon) to install on hassio.
if you didnt install hassio (the operating system) but for example hasbian or just linux with home assistant, you shouldnt use hassio addons, but just install the right program.

how to install appdaemon the right way for your system can be found in the appdaemon docs.
https://appdaemon.readthedocs.io/en/latest/INSTALL.html

1 Like

@ReneTode You’re right, but @baz123 installed hassio on raspbian (IIRC) and then it’s probably worth using the add-on instead of plain docker.

correct, if hassio is installed then you need to install addons, but at that point also forget about docker :wink:
because allthough its dockerbased, you dont have to do and understand with docker at all when using hassio.

and indeed the addon does work different from normal ways in more ways then i like :wink:
it sets token on its own, manipulates the appdaemon.yaml, replaces files that are normally in the config dir, etc.
there are many many times that i really am puzzled how they modified stuff and why and how those with hassio need to do things different.

and it doesnt help if people dont understand the difference between hassio and homeassistant or docker and addon. (and i understand there confusion)

Ok, I updated the docs to reflect the steps needed to configure hass-apps with the add-on.

1 Like

Which brings me back to the difference between HA & hassio. I installed, what I installed, from these instructions hassio-build/install at master · home-assistant/hassio-build · GitHub. It would seem I installed hassio inside a docker. What the pros and cons to that are obscure.

I had found previously that the hassio version seemed to be a more flexible solution wrt addons. Perhaps that has changed. TBH, the install instructions are far too biased towards Raspberry Pis - I am using a DietPi base as a VM, installed docker and then hassio. Works like a charm, but I stumbled across that solution rather than made an informed choice.

the difference between hassio and HA are like i described.
hassio is not a program, but an operatingsystem. HA is a program.
what you actually did is something like installing linux on a windows machine. inside some kind of wrapper (docker)

you probably try to say that you found that installing homeassistant on hassio seemed to be more flexible because hassio has addons, then installing home assistant on raspbian without hassio

hassio was never about flexibility, hassio is about easy install and doing the settings for you so that you dont need to think. but by letting a program set your settings, you lose the flexibility to do it yourself.

because its not a logical choice.
most people chose between this 2 options:

  1. make the RPI dedicated to homeassistant and install hassio as operating system
  2. chose for more flexibilty and install any kind if linux environment (raspbian, hassbian, raspbian light, etc.) and then just install home assistant.( in a venv or docker or just with pip)

you have chosen a difficult way to install an environment that is created to make it easy for users.

but it gives you options.
because you have hassio in a docker you can install the appdaemon addon inside hassio, but because you also have a rasbian environment you can also install appdaemon in a venv or as a normal docker.
and to make it difficult you could do those things all side by side.

its for you to find out what you like more.

@ReneTode There is one point I disagree with. Hassio is no operating system, it’s Home Assistant, an add-on store and a supervisor bundled together as a set of docker containers.

By saying to install hassio on a raspberry pi, you probably mean to install hassos, wich is an operating system containing docker + the hassio processes and some scripts for management.

If I wanted simplicity, I’d probably choosen hassos and let it do all the heavy lifting for me.

@baz123 Did you really install dietpi in a VM? What machine does this VM run on? Because if it’s a virtualized ARM system on a normal x86 machine, you should consider installing the official x86-64 OVA image of hassos instead. This will make performance a lot better.

i did write a whole piece and even when i was writing it i got confuesed , so its no wonder that people get confused :wink:

most likely because it changes what it is.
according to the docs at this point: hassos is a part from hassio.

so you could say that hassio is hassos(an operating system) with 2 apps (homeassistant and addonstore) preinstalled.
and before hassos existed it was another cleaned out OS
and before that hassio was without os at all (which is probably what baz now uses
and before that we had hassbian which didnt have the addon store.

i would probably also chose the complete setup if i would go for hassio. (allthough the way baz did set it up is less restricted then the complete hassio version they have at the moment)

1 Like

Yeah, that’s all really confusing. At least hassos is the recommended way of installing hassio. And for the sake of flexibility, you can of course create your own add-ons as well that then run in docker on hassos.

I generally don’t like these highly specialized implementations because there’s a lot room for bugs and glitches. I recently managed to break a hassos running in KVM by just resetting the power. The whole file system was messed up afterwards and it didn’t boot anymore… bet this wouldn’t have happened with a rock solid Debian underneath.

At least I would always prefer a good old Debian/Fedora/whatever you feel comfortable with + a dockerized HA and AppDaemon over the hassos stuff, although the seamless atomic upgrades of hassos sound really nice.

One dumb question again… Is it possible to have a condition for the schedule to kick in like if temperature is below than x? Is it a question of the switch?I speak for heaty here because if it’s warm I don’t need to chedule … Because heaty and shedy kick in tu schedule no matter what the actual temp is.

@thundergreen Of course you can define a rule that aborts scheduling if some condition is met, but it should be the responsibility of your thermostats to decide whether they have to heat to reach the set target temperature or not.

I agree but apparently th thermostat in th ac is not that precise …that’s why I ask.so I have to write an Automation that switches of the switch for the schedule x if temp is higher than y?