Thanks for sharing, I am trying to make sense of the configuration you put together. How do the different section relate together? In the power output you refer to switch.mystrom_switch but you didn’t quite define that as an ID anywhere, is it automatically inferred from the platform, similarly you refer to the sensor.energy_consumption without really having defined it elsewhere.
Maybe I am missing some basic understanding of the templating, I could likely grasp it, if you could share on your concrete example.
DISCLAIMER I am not an expert but here is my “believe” … DISCLAIMER
In the power output you refer to switch.mystrom_switch but you didn’t quite define that as an ID anywhere, is it automatically inferred from the platform
… since I am not an expert I sometimes mix and match code-snippets from different sources until it works. So this is just a different way I guess of defining a sensor. The name sensor.energy_consumption is derived from the friendly name automatically in line: name: “Energy Consumption”.
Invalid config for [switch.rest]: [value_template] is an invalid option for [switch.rest]. Check: switch.rest->value_template. (See ?, line ?).
Platform error switch.integration - No module named 'homeassistant.components.integration.switch'
I am really new so pardon me If it’s an easy fix for you.
@pixelwave same for yours I don’t understand how to fully integrate it, I keep getting errors
For the MyStrom device, one solution could be to just flash it with Tasmota. For that, you have to open it up (needs a triangle screwdriver), solder a USB-TTL converter, and flash from your computer (it’s doable, but not trivial if you haven’t done it before).
To make it work with the REST API, I used the following in the configuration.yaml:
switch:
- platform: mystrom
name: mystrom_switch1
host: 192.168.178.199
sensor:
- platform: rest
name: "mystrom_power1"
resource: http://192.168.178.199/report
method: GET
unit_of_measurement: W
device_class: power
state_class: measurement
value_template: "{{ value_json.power }}"
- platform: integration
source: sensor.mystrom_power1
name: "mystrom Energy Consumption"
unit_prefix: k
round: 3
Note that you have to place them in separate sections - switch & sensor. It checks every 30 seconds.
I have a variation of this.
While everyone is using the power attribute, I am using the Ws attribute from the API which gives an average of the power used / sec from the last request.
Invalid config for [switch.template]: [sensors] is an invalid option for [switch.template]. Check: switch.template->sensors. (See ?, line ?).
Platform error switch.integration - No module named ‘homeassistant.components.integration.switch’
The Integration doesn’t work for me? It doesn’t report any numbers. The Rest Call does work, there i see the power consumption, but then in the Energytab there is nothing reportet with the sensor. Any idea?
- platform: rest
name: "mspower_buro"
resource: http://192.168.21.155/report
method: GET
unit_of_measurement: W
device_class: power
state_class: measurement
value_template: "{{ value_json.power }}"
- platform: integration
source: sensor.mspower_buro
name: "Büro Verbrauch"
unit_prefix: k
round: 3
I have 7 sensors with different names. so the “ü” shouldnt be any problem
I use my myStrom plugs for photovoltaic statistics.
What I would still like to use in hassio would be the total PV production per day from all plugs (I use 3).
Anyone an idea for a integration?
Hi, thanks for the hint. Do you have an Idea how it should look like, when I want to integrate another mystrom switch. Especially the part with {{ value_json.power }}. Doesit need to be the same or do I need to rename it forevery switch?
Thanks Oliver