Introducing ... TheSillyHome , a Homeassistant Machine Learning (AI) Addon

Hi
i ran in my docker compose
and get this error exec /startup/run: no such file or directory

Thanks @Cao_Hoa for trying this out. Could you share me your docker-compose.yml? You shouldn’t need to create a thesillyhome_config folder so interested to know why its there.

here is my docker-compose file.

thesillyhome:
container_name: thesillyhome
image: lcmchris1/thesillyhome-container:latest
restart: unless-stopped
volumes:
- /home/thongtuehome/docker/thesillyhome_config:/thesillyhome_src/data/config/
ports:
- 2300:2300

db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: thongtuehome090916
MARIADB_DATABASE: homeassistant
MARIADB_USER: homeassistant
MARIADB_PASSWORD: thongtuehome090916

 volumes:
   - /home/thongtuehome/docker/mariadb:/var/lib/mysql
 ports:
   - "3306:3306"

Thanks again. I’ve re-pushed a new image and also to github.

Could you re-pull both and also use lcmchris1/thesillyhome-container:0.0.1 in your docker-compose.yml?
I suspect its pointing to an older version of the image.

thank you i will install always what i will inform you have a good day

1 Like

@Nova
Good day I spun your latest image and I get a webui.

I tried editing your options.json, but I have some questions.

Is the database section a connection to HA database? or are you creating a db for the component?

I added options.json and appdaemon. yaml as such

    volumes:
      - /mnt/cache/appdata/thesillyhome/config:/thesillyhome_src/data/config/
      - /mnt/cache/appdata/thesillyhome/appdaemon:/thesillyhome_src/appdaemon/

My homeassitant db is in postgres

I think it’s starting correctly. Below see docker logs, but it breaks with the database

Starting to parse DB data
INFO:root:Reading from homedb...
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/thesillyhome_src/thesillyhome/src/thesillyhome/model_creator/main.py", line 13, in <module>
    parse_data_from_db()
  File "/thesillyhome_src/thesillyhome/src/thesillyhome/model_creator/parse_data.py", line 129, in parse_data_from_db
    df_all = homedb().get_data()
  File "/thesillyhome_src/thesillyhome/src/thesillyhome/model_creator/home.py", line 29, in get_data
    mydb = mysql.connector.connect(
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/__init__.py", line 179, in connect
    return MySQLConnection(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/connection.py", line 95, in __init__
    self.connect(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/abstracts.py", line 716, in connect
    self._open_connection()
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/connection.py", line 207, in _open_connection
    self._do_handshake()
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/connection.py", line 99, in _do_handshake
    packet = self._socket.recv()
  File "/usr/local/lib/python3.10/site-packages/mysql/connector/network.py", line 243, in recv_plain
    raise errors.InterfaceError(errno=2013)
mysql.connector.errors.InterfaceError: 2013: Lost connection to MySQL server during query
Starting Appdaemon
Starting frontend on 0.0.0.0:2300
Listening on 0.0.0.0:2300
2022-06-07 16:52:28.378094 INFO AppDaemon: AppDaemon Version 4.2.1 starting
2022-06-07 16:52:28.378183 INFO AppDaemon: Python version is 3.10.4
2022-06-07 16:52:28.378224 INFO AppDaemon: Configuration read from: /thesillyhome_src/appdaemon/appdaemon.yaml
2022-06-07 16:52:28.378261 INFO AppDaemon: Added log: AppDaemon
2022-06-07 16:52:28.378301 INFO AppDaemon: Added log: Error
2022-06-07 16:52:28.378338 INFO AppDaemon: Added log: Access
2022-06-07 16:52:28.378373 INFO AppDaemon: Added log: Diag
2022-06-07 16:52:28.385476 WARNING AppDaemon: appdir: /thesillyhome_src/appdaemon/apps does not exist exist
2022-06-07 16:52:28.385864 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2022-06-07 16:52:28.464596 INFO HASS: HASS Plugin Initializing
2022-06-07 16:52:28.464671 INFO HASS: HASS Plugin initialization complete
2022-06-07 16:52:28.464826 INFO AppDaemon: HTTP is disabled
2022-06-07 16:52:28.467442 INFO HASS: Connected to Home Assistant 2022.6.3
2022-06-07 16:52:28.467640 INFO AppDaemon: Starting Apps with 0 workers and 0 pins
2022-06-07 16:52:28.486871 INFO HASS: Evaluating startup conditions
2022-06-07 16:52:28.488465 INFO HASS: Startup condition met: hass state=RUNNING
2022-06-07 16:52:28.488552 INFO HASS: All startup conditions met
2022-06-07 16:52:28.578688 INFO AppDaemon: Got initial state from namespace default
2022-06-07 16:52:30.470402 INFO AppDaemon: Scheduler running in realtime
2022-06-07 16:52:30.471014 INFO AppDaemon: App initialization complete


mine get this error

Hi @juan11perez ,

Is the database section a connection to HA database? or are you creating a db for the component?
The component just connects to the HA database (for now).

I haven’t added support for other DB types yet (only mariadb for now). This shouldn’t be hard to implement and will do so shortly!

++ There is code to copy over the HA details under ha_options so you can just use options.json and not worry about the appdaemon.yaml

Hi @Cao_Hoa ,
Juan above did it well by having the option.json mounted there and editing the file locally. Could you try this?

Really appreciate you both for powering through all the bugs so far @Cao_Hoa & @juan11perez
I’ve created a discord support channel which you could also use TheSillyHome if it is more convenient for you.

i see u make out 2.0 version , what a new config option ? i suggest db_type: mariadb
end image dont start

standard_init_linux.go:228: exec user process caused: exec format error

Hi @lotohov
I made a new version that now uses the same image as the standalone thesillyhome-container.
The new config parameter is to help support postgres as well. (The parameter takes either : mariadb or postgres.

I think I can see the issue… I only tested the new design on my pc but haven’t actually tried it on the Pi itself. Let me get on fixing this now! Thanks for raising this.

1 Like

Hi @lotohov

I have now re-added support for arm machines (pi) for the docker image.

I have also now segregated out dev and stable - as 2 separate image tags (dev vs 0.0.1) and 2 separate addons (thesillyhome-addon-dev vs thesillyhome-addon).

thesillyhome-addon 2.0.1-dev is prone to changes and random commits by me so may or may not be broken as I will try to make features quickly on my dev build without full testing on all platforms.

thesillyhome-addon 2.0.1 is now stable and I won’t update this unless theres some immediate bug fix that’s needed. When there’s a new big feature made in dev I will upgrade this and fully test on the pi as well.

The new process should make this more manageable for me and make it more useable.
Always happy to take feedback!

INFO:root:Training model for light.0x804b50xxxxxxxxx4a5
INFO:root:No cases found for light.0x804b5xxxxxxxxxxa5
INFO:root:Training model for light.bathroom
INFO:root:No cases found for light.bathroom
INFO:root:Training model for light.entrance
INFO:root:No cases found for light.entrance
INFO:root:Training model for light.kabinet
INFO:root:No cases found for light.kabinet
INFO:root:Training model for light.kitchen
INFO:root:No cases found for light.kitchen
INFO:root:Training model for light.kitchen_strip
INFO:root:No cases found for light.kitchen_strip
INFO:root:Training model for light.spalnaya
INFO:root:No cases found for light.spalnaya
INFO:root:Training model for light.toliet
INFO:root:No cases found for light.toliet

does this mean anything ?

Yes, it means what it says.

Hi @lotohov
This means that in the mariadb/postgres db the homeassistant.states table does not have any entries for those entity_ids.

Possible reasons:

  • If you have just migrated to a dthen it is possible that these devices have never been triggered yet. You could easily check on the HA web history tab to see if you had any events on for these devices.
  • Setting the recorder to not purge data is also recommend (as the default is 5 days so you might not have much data to work with)
  • The ids listed might be incorrect. They do look correct though :slight_smile:

For me to help triage, I would need zip of your states DB top 1000 rows (you can access using mysqlworkbench)

Always happy to help!

Hi Everyone,

A small summary from me. I have updated the documentation on the different repos.

thesillyhome-container - now hosts all the main documentation including the Motivation, Installation steps and design.
thesillyhome-addon-repo - now hosts only the homeassistant addon relevant information.
thesillyhome - is now defunct. All the code is hosted within thesillyhome-container.

1 Like

Interesting stuff. I am trying to understand how this works. The tool is fed with actuators and sensors and concludes what needs to happen based on history. I guess you first need to have a working home automation (if motion when dark then light on) in order to let it learn?
Do you also need to feed it with global things like time and azimuth? How do you correct the machine? Does it distinguish between different scenarios? For one lamp: wall switch → on but motion sensor only when dark → on?

Hi @balk77 , thank you for expressing interest.
Let me try to answer your questions.

You do not need working automation routines to make this work. In fact having these setup it defeats the purpose of the tool as it will basically learn/copy the rules. How it works is when you go about your day as usual and turn on lights, move around (triggering sensors) etc, the history generated is representative of when you would want your devices to be turned on.

At the moment, time is inbuilt to the product. Azimuth or others (weather) you can add as a ‘sensor’.

There is an upcoming feature for you to correct specific actions. This is essentially a “human-in-the-loop” which can really help with the tough rare cases.

I might misunderstand here but as the machine learning model takes into account numerous of variables so can differentiate on different scenarios.

Hope all this helps!