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

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!

Hi Team! Apologies for quite a delay in releasing new features. I was hit with the virus and wasn’t feeling all to well.

I have now pushed a new version to dev in dockerhub under the dev tag. This will be into the next weeks stable version.

This update includes changes to the frontend.

  1. Recalibration with a button (instead of restarting the container ) for zero downtime. The Console logging is not async and so does only show output once the re-running completes.

  2. Metrics dashboard - you can now review how the models are performing.

Keep it silly folks!
The next update is going to be focused on the models and accuracy :slight_smile: (the fun stuff)

thats nice ) i found that my new models was schooled by the automations ) now i have two automations )

1 Like

Check out this new thread, home to all our release documentation!

Checkout our new Silly Home service on the cloud.

It’s free. Sign up now!

This is a culmination of 3 months of hard work and your interest, feedback and support is crucial to its development. Even if your platform is not available yet, sign up to register your interest!

No one here wants a cloud solution.

5 Likes

Hi, I installed and launched thesillyhome-addon-repo. What to do next? How to use it?

Hi! I installed the Addon in Home assistant. Configured

- db_password: password
  db_username: homeassistant
  db_host: 192.168.1.134
  db_port: "3306"
  db_database: home-assistant_v2.db
  db_type: sqlite

installed

MariaDB
Current version: 2.5.2

In the magazine writes:

Starting to parse DB data
2023-02-07 09:21:56,743 - root - INFO - Reading from homedb...
2023-02-07 09:21:56,754 - root - INFO - Getting data from internal homeassistant db
2023-02-07 09:21:56,754 - root - INFO - Executing query
2023-02-07 09:21:56,763 - root - WARNING - Cannot find actuator cases for ids {'light.bathroom_lights', 'switch.livingroom_entrance_switch_right', 'light.bedroom_ceiling_light', 'switch.livingroom_entrance_switch_left', 'light.bedroom_sidetable_lamp', 'light.corridor_lights', 'switch.livingroom_entrance_switch_center'}. Removing...
2023-02-07 09:21:56,763 - root - WARNING - Cannot find sensor cases for ids {'binary_sensor.bathroom_entrance_sensor_occupancy', 'binary_sensor.corridor_end_sensor_occupancy', 'sensor.corridor_end_sensor_illuminance_lux', 'binary_sensor.livingroom_desk_sensor_occupancy', 'weather.home', 'sensor.livingroom_desk_sensor_illuminance_lux', 'sensor.corridor_entrance_sensor_illuminance_lux', 'sensor.bedroom_entrance_sensor_illuminance_lux', 'binary_sensor.chris_phone_is_charging', 'binary_sensor.bedroom_entrance_sensor_occupancy', 'device_tracker.chris_phone', 'binary_sensor.corridor_entrance_sensor_occupancy', 'sensor.bathroom_entrance_sensor_illuminance_lux'}. Removing...
2023-02-07 09:21:56,764 - root - INFO - []
2023-02-07 09:21:56,764 - root - INFO - []
2023-02-07 09:21:56,766 - root - INFO - Add previous state...
2023-02-07 09:21:56,766 - root - INFO - Start parallelization processing...
2023-02-07 09:21:56,784 - root - WARNING - No metrics.
2023-02-07 09:21:56,785 - root - INFO - Completed!
2023-02-07 09:21:56,799 - root - INFO - Runnining cron with cadence 0 0 * * 0
Starting Appdaemon
Starting frontend on 0.0.0.0:2300
Listening on 0.0.0.0:2300
2023-02-07 06:21:57.675989 INFO AppDaemon: AppDaemon Version 4.2.1 starting
2023-02-07 06:21:57.676117 INFO AppDaemon: Python version is 3.9.16
2023-02-07 06:21:57.676201 INFO AppDaemon: Configuration read from: /thesillyhome_src/appdaemon/appdaemon.yaml
2023-02-07 06:21:57.676305 INFO AppDaemon: Added log: AppDaemon
2023-02-07 06:21:57.676380 INFO AppDaemon: Added log: Error
2023-02-07 06:21:57.676444 INFO AppDaemon: Added log: Access
2023-02-07 06:21:57.676520 INFO AppDaemon: Added log: Diag
2023-02-07 06:21:57.688343 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2023-02-07 06:21:57.825857 INFO HASS: HASS Plugin Initializing
2023-02-07 06:21:57.826516 INFO HASS: HASS Plugin initialization complete
2023-02-07 06:21:57.826805 INFO AppDaemon: HTTP is disabled
2023-02-07 06:21:57.833473 INFO HASS: Connected to Home Assistant 2023.2.2
2023-02-07 06:21:57.846275 INFO AppDaemon: App 'model_executor' added
2023-02-07 06:21:57.848495 INFO AppDaemon: Found 1 total apps
2023-02-07 06:21:57.849276 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2023-02-07 06:21:57.877802 INFO HASS: Evaluating startup conditions
2023-02-07 06:21:57.887557 INFO HASS: Startup condition met: hass state=RUNNING
2023-02-07 06:21:57.887868 INFO HASS: All startup conditions met
2023-02-07 06:21:57.903660 INFO AppDaemon: Got initial state from namespace default
2023-02-07 06:21:59.854620 INFO AppDaemon: Scheduler running in realtime
2023-02-07 06:21:59.856436 INFO AppDaemon: Adding /thesillyhome_src/appdaemon/apps to module import path
2023-02-07 06:21:59.857432 INFO AppDaemon: Loading App Module: /thesillyhome_src/appdaemon/apps/model_executor.py
2023-02-07 06:22:00.116386 INFO AppDaemon: Initializing app model_executor using class ModelExecutor from module model_executor
2023-02-07 06:22:00.140936 WARNING model_executor: ------------------------------------------------------------
2023-02-07 06:22:00.141764 WARNING model_executor: Unexpected error running initialize() for model_executor
2023-02-07 06:22:00.142593 WARNING model_executor: ------------------------------------------------------------
2023-02-07 06:22:00.144165 WARNING model_executor: Traceback (most recent call last):
  File "/opt/venv/lib/python3.9/site-packages/appdaemon/app_management.py", line 165, in initialize_app
    await utils.run_in_executor(self, init)
  File "/opt/venv/lib/python3.9/site-packages/appdaemon/utils.py", line 337, in run_in_executor
    response = future.result()
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/thesillyhome_src/appdaemon/apps/model_executor.py", line 27, in initialize
    self.init_db()
  File "/thesillyhome_src/appdaemon/apps/model_executor.py", line 51, in init_db
    db_rules_engine.loc[0] = 1
  File "/opt/venv/lib/python3.9/site-packages/pandas/core/indexing.py", line 716, in __setitem__
    iloc._setitem_with_indexer(indexer, value, self.name)
  File "/opt/venv/lib/python3.9/site-packages/pandas/core/indexing.py", line 1682, in _setitem_with_indexer
    self._setitem_with_indexer_missing(indexer, value)
  File "/opt/venv/lib/python3.9/site-packages/pandas/core/indexing.py", line 1982, in _setitem_with_indexer_missing
    raise ValueError("cannot set a frame with no defined columns")
ValueError: cannot set a frame with no defined columns
2023-02-07 06:22:00.146623 WARNING model_executor: ------------------------------------------------------------
2023-02-07 06:22:00.147353 INFO AppDaemon: App initialization complete

Is this how it should be? Does it work? Where can I track or watch something? Thanks for the help

Hi @Vex - Apologies for the slow reply. Once launched, it should start making predictions and execute actions on your behalf.

Hi @customstudioyandexru,
From what I can see, the default actuators and sensors are used in the config. This would most likely not match your own entity_ids of actuators and sensors you have in your home. You would change the config to match them :slight_smile:


Почему то не выводит список. Так и должно быть?


For some reason there are no devices


Maybe you need to replace sqlite with mariadb

Does is work with InfluxDB as well?
I don’t see it on the list, any plans to support it?

1 Like