Smart-Me electricity meter

Hi guys,

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.

1 Like

Did you make any progress? We had our powermeter installed today(smart-me) and I will look in to this shortly. Thank’s for the usefull details!

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.

OK, here is the relevant part from my configuration.yaml file:


MyStrom Oil Radiator switch

switch:

  • platform: mystrom
    host: 192.x.x.x
    name: OilRadiator

Smart-Me meter

sensor:

  • platform: rest
    name: SmartMeter
    json_attributes:
    • ElectricityCounterValue
    • ElectricityPower
      resource: https://smart-me.com:443/api/Folder/xxxxxxxyourdeviceidxxxxxxxxxxxxx
      authentication: basic
      username: yoursmartmeusername
      password: yoursmartmepassword
      unit_of_measurement: kWh
      Content-Type: application/json
      User-Agent: Home Assistant REST sensor
      value_template: ‘{{ value_json.ElectricityPower }}’
  • platform: dht
    sensor: DHT22
    name: Living Room
    scan_interval: 5
    pin: 14
    monitored_conditions:
    • temperature
    • humidity

Here is the script.yaml part:

‘xxxxxxxxxxxxxxxxx’:
alias: Radiator ON
sequence:

  • data: {}
    service: switch.turn_on
    entity_id: switch.OilRadiator
    ‘xxxxxxxxxxxxxxxx’:
    alias: Radiator OFF
    sequence:
  • data: {}
    service: switch.turn_off
    entity_id: switch.OilRadiator

and finally, here is the automations.yaml part:

  • id: ‘xxxxxxxxxxxxxxxxxxxx’
    alias: Use solar to heat - on
    trigger:
    • below: ‘-1’
      entity_id: sensor.smartmeter
      platform: numeric_state
      condition:
    • condition: state
      entity_id: switch.OilRadiator
      state: ‘off’
    • below: ‘21’
      condition: numeric_state
      entity_id: sensor.living_room_temperature
      action:
    • alias: ‘’
      data: {}
      service: switch.turn_on
  • id: ‘xxxxxxxxxxxxxxx’
    alias: Use solar to heat - off
    trigger:
    • above: ‘0’
      entity_id: sensor.smartmeter
      platform: numeric_state
    • above: ‘21’
      entity_id: sensor.living_room_temperature
      platform: numeric_state
      condition:
    • 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… :slight_smile:

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`

Hi, what smart meter do you have? Is it a Landis-Gyr meter?
I have L+G E360 and would like to do the same.

Hi there,
As per the title of the thread, this is about the Smart-Me smart meters: Energy Management - easy, affordable, suitable for the mass

Unfortunately, I am not aware of a Landis+Gyr integration however I found this thread: Need help with p1 config smart meter Landys Gyr E360 - #9 by Remirz

They refer to a couple of integrations that might get you up and running:

&