-
Notifications
You must be signed in to change notification settings - Fork 1
2. Running Energy Router in AppDaemon
In Home Assistant, install AppDaemon from the Community Add-on store, if you did not already.
Edit the /addon_configs/a0d7b954_appdaemon/appdaemon.yaml file. A basic version has been put in place at installation time. Add the missing parameters. See notes below.
secrets: /homeassistant/secrets.yaml
appdaemon:
(...)
plugins:
HASS:
type: hass
app_init_delay: 10
MQTT:
type: mqtt
namespace: mqtt
client_id: appdaemon-unique-id
client_host: core-mosquitto
client_user: !secret mqtt_user
client_password: !secret mqtt_password
client_topics:
- some/nonexisting/topic
http:
url: http://127.0.0.1:5050
admin:
api:
hadashboard:
logs:
error_log:
filename: /homeassistant/appdaemon/logs/error.log
main_log:
filename: /homeassistant/appdaemon/logs/main.log
access_log:
filename: /homeassistant/appdaemon/logs/access.log
diag_log:
filename: /homeassistant/appdaemon/logs/diag.log
energyrouter_log:
name: energyrouter
filename: /homeassistant/appdaemon/logs/energyrouter.log
Notes:
-
Since AppDaemon v. 0.15, this file moved to a location outside the Home Assistant configuration folder tree. To access this file with File Editor, go to the File Editor add-on Configuration page, and set the Enforce Basepath parameter to
false. -
Make sure to have the required values in your secrets.yaml file.
-
client_topics: if you don't have a good reason to write something else, just leave this parameter as it is. We do not need any subscription to an MQTT topic here, but setting this parameter to "none" will produce annoying warning messages when subscribing to MQTT topics in code.
-
logs: make sure to create a "logs"-folder in /config/appdaemon to provide a place for the logs.
When done, restart AppDaemon.
Open its web interface on port 5050, and have a look at the main log. It is important to configure the MQTT-plugin correctly, so that it starts up smoothly. Check in the mainlog.
Copy energy_router.py and energy_router.yaml from the AppDaemon folder of this repository to the /addon_configs/a0d7b954_appdaemon/apps folder of your H.A. installation.
Note: you can use the File editor add-on to upload files from your workstation to your H.A. installation.
Open energy_router.yaml in your favorite text editor. AppDaemon will restart the Energy Router as soon as you save the file.
go: switches the Energy Router on or off.
sensor_gridpower: enter the name of the sensor connected to your energy meter, returning the power consumed by the household. Power should be in W. Positive values for consumption, négative values for sending power into the public electricity grid. However, the preferred method is to get the energy meter readings directly from the MQTT broker, if they are available there. Enter the MQTT topic used by the energy meter reading (parameter mqtt_topic_gridpower).
See README.md for more configuration parameters.
Open the AppDaemon web interface on port 5050. Go to the logs page, select the energyrouter_log.
You should get a line about Energy Router being disabled.
In energy_router.yaml, set the go parameter to 1 and save the file.
The Energy Router should start (watch the log file). There should be a couple of lines in the log:
-
Energy Router start,
-
a line about RouterMode (if you already configured the H.A. entities to control the router, i.e. the corresponding retained topic has been left in the MQTT broker),
-
a line about gridpower, with the current value,
-
a line about the dimmer being online or offline (only if the dimmer already connected at least once to the MQTT broker, and left a retained topic about its online status).
When all the pieces of the project will have been put together, all these lines should show up every time you restart Energy Router.
AppDaemon will restart the Energy Router app automatically every time you save a new version of the energy_router.yaml file.