Hey, does anyone use https://www.energomonitor.com to monitor power consumption. Curious to know if its possible to intergrate into home assistant.
I installed this quite a while back. Would be interested to know what energy monitor I could replace it with to get energy use data into Home Assistant in Australia.
Iād be interested in this too. I have two setups running in two houses and the data out is really stable and informative. An āEnergomonitorā Integration would be great to have if there were such a thing.
I have HA grabbing data from the energomonitor API. Itās not an official integration but has been running quite successfully for a few years. I grab the main value, and also some from the individual appliance monitors. Only pain point is having to generate a new API token every 30 days.
Youāll need to generate a API token on the https://app.energomonitor.cz site (link in footer of page), and use the API Demo to find the feed_id and stream_id (e.g. Mains W, Mains Wh, or appliance1 W, etc) of the channels you want data for.
Put your API token in secrets.yaml:
energomonitor_api_key: 'Bearer [your_api_key]'
The āBearerā part tripped me up for while, donāt forget to include it. You should end up with something like energomonitor_api_key: 'Bearer CfsfkxXbRVeZuYjP7TutKo9brmc0eY9'
To overcome the 30 days limitation, I created a script that renews the API token via CURL message. It parses the answer and writes the new token directly to the secrets.yaml file as per syntax.
You may put this sctipt to cron to run every 30days.
I hadnāt thought about anything like that. Iāve tweaked your bash script a bit to work for me.
the single > would have overwritten the whole secrets file. And the grep commands needed an *, without the * I was only getting a single character.
Iāve changed my set up to write the energomonitor api key to itās own file: /config/energomonitor_api_key.yaml and updated my secrets.yaml to include it:
I tested the script and it worked fine with me. So I started wondering, how itās possibe.
Apparently, when I copied the line here it removed those ā*ā as they are used in editing.
This picture shows the how this is seen on āeditā more and on the right side as āseen on webā mode
From much searching the forum and googling, it seems that you canāt use cron with hassos (cron entries disappear after a reboot) and all the suggestions were to use an automation instead.
and also the condition restricts it to only run on every 28th day (based on the unix epoch) so youāll want to disable that while testing your 15 minute run. Today (Jan 18th 2023) is a 27 not a 0 according to {{ (now() - as_datetime('19700101T00Z')).days % 28 }} so it wouldnāt have run today.
Although, first I wonderend why the key was saved as āenergomonitor_api_key.yaml?ā with a ā?ā at the and of file.The script did add some special, invisible characters also. And because of those the file save did not work.
I realised that there is faint markings at the end of the line. Seen only on HA File-editor
egā¦
Howeverā¦it suppose to be this
I used nano and the File Editor in HA. But I canāt repeat the issue. So I donāt know how I did this?
Sorry, you are on your own here. Iām guessing itās a platform/line endings thing. Are you on Windows?
I do all my editing via SFTP and my normal text editor (Transmit for SFTP, BBEdit for editing) so all my files are set to UTF-8, Unix (LF) line endings.
Quite old topic, but yet still relevant for me. Iām a new in HA (third day since having HA green) and trying to get Energomonitor work with me. Just to make sure, does these still work for you @marpelto and @wade?