I am super new to HASSIO so please play nice.
I’ve worked in IT for many years but I’ve never written any code beyond basic .bat files etc.
I have installed HASSIO on a RPi 3 B. All is working nicely.
I have added control of my mains power switch made by MyStrom using this page: https://home-assistant.io/components/switch.mystrom/.
I can now turn my 1kW oil radiator on and off perfectly from HASSIO.
I have a smart meter on my electricity feed. I have solar panels on my house. What I want to do is to have it so that if I am exporting over 1kW of spare electricity and the oil radiator is off, it should switch on and heat the house. If the amount of power being exported from the house drops below what the oil radiator consumes, it should switch off again. This cycle should continue non-stop as solar generation increases/decreases with the weather/cloudcover etc. The goal is to use my own energy to heat the house as much as possible but not to import grid power.
I’m hoping that this is not going to be tooooo tricky. I see that the MyStrom switch is already supported so that part was super easy. The smart meter is not officially supported yet but I have found that they have a REST API here (https://smart-me.com/swagger/ui/index). I can see from testing on that page that I can pull some values that include the import/export amount by using https://smart-me.com:443/api/Devices
This generates a lot of data, including this:
Response Body
[
{
“Id”: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”,
“Name”: “xxxxxxxxxxx”,
“Serial”: xxxxxxxxxx,
“DeviceEnergyType”: 1,
“FamilyType”: 6, "ActivePower": 0.18,
“ActivePowerUnit”: “kW”,
“CounterReading”: -2867.34,
“CounterReadingUnit”: “kWh”,
“Active power” is exactly what I need to see how much energy I am importing/exporting (positive of negative numbers)
Is this sort of automation within the grasp of a beginner? I would love to automate the consumption of more of my home-grown solar energy but don’t want to be battling it until Summer comes along and I don’t need the heat anymore!!
If anyone can tell me what I’m getting in to, that would be cool. If anyone has played with something similar and can share anything that will help me, that would be gratefully received.
Yes, I got it working perfectly. I heated my house for free most of last winter!
I’ll dig out the config and post it in here as soon as I get some time.
condition: state
entity_id: switch.OilRadiator
state: ‘on’
action:
alias: ‘’
data: {}
service: switch.turn_off
With those in place, my HASSIO will check if I am exporting at least 1kW of spare solar power to the grid AND the radiator is not currently on AND that my living room is below 21 degrees C (as measured by a $3 DHT22 plugged into the GPIO pins of the RPi). If all 3 of those conditions are met, it will switch on a smart plug (from MyStrom in my case) into which I have plugged a 900W oil radiator.
If my solar dips and I begin importing energy from the grid, it will then switch that radiator off. If the room temp goes above 21 degrees, the rad also switches off.
It works great and heated the ground floor of my house for free very effectively while I was at work. I came home to a nice warm house and didn’t need to have the main radiators on in the evening (when the sun has gone down and I would have to import from the grid).
Shout if something is missing or doesn’t make sense.
Hi
I have bought me a SmartMe meter for my Kamstrup.
And have tried configuring Home Assistant to retrieve the ElectricityPower attribute.
I had to remove
Content-Type: application/json
User-Agent: Home Assistant REST sensor
from the configuration - otherwise HA says it is invalid…
But I don’t get any data… Just a blank attribute
Does this still work for you? - or is there changed requirements since you wrote about this?
Found the required changes by figuring out how to use curl - and a lot of google…
To find the correct device-id install curl and do the following command:
´curl -X GET -u "[mail-addr]:[password]" -H "Content-Length: 0" https://smart-me.com:443/api/Devices`
Extract the device-id of your smart-me from the result (in my case a 32 digit hex-code)
and insert it into the resource specification:
`resource: https://smart-me.com:443/api/Device/xxxxxxxyourdeviceidxxxxxxxxxxxxx`