aslu
(Aslam)
June 14, 2019, 3:41am
1
Hi,
I’m new to Home assistant.
I need help to sum the values of sensor.
I have pzm004 for 3 phase. i have values of each phase and want to add the 3 phase consumption together.
Gone thru all the available documents but no luck.
the following are the entities to sum the values.
sensor.phase_1_energy_power, sensor.phase_2_energy_power, sensor.phase_3_energy_power
Thanks & Regards,
Aslam
gumbo
June 14, 2019, 5:14am
2
How about something like the following:
value_template: “{{ states(‘sensor.phase_1_energy_power’) | float + states(‘sensor.phase_2_energy_power’) | float + states(‘sensor.phase_3_energy_power’) | float }}”
1 Like
aslu
(Aslam)
June 14, 2019, 5:27am
3
Hi Gumbo,
i have the following error,
Invalid config for [sensor.template]: invalid slug KSEB (try kseb) for dictionary value @ data[‘sensors’]. Got OrderedDict([(‘KSEB’, OrderedDict([(‘value_template’, ‘“{{ states(‘sensor.phase_1_energy_power’) | float + states(‘sensor.phase_2_energy_power’) | float + states(‘sensor.phase_3_energy_power’) | float }}”’), (‘entity_id’, ‘sensor.float’), (‘friendly_name’, ‘KSEB’), (‘unit_of_measurement’, ‘Watt’)]))]). (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.template/
my config is
sensor:
platform: template
sensors:
KSEB:
value_template: “{{ states(‘sensor.phase_1_energy_power’) | float + states(‘sensor.phase_2_energy_power’) | float + states(‘sensor.phase_3_energy_power’) | float }}”
entity_id: sensor.float
friendly_name: ‘KSEB’
unit_of_measurement: “Watt”
where is KSEB is mentioned as my electricity provider.
Thanks & Regards,
Aslam
tom_l
June 14, 2019, 6:44am
4
Please format your pasted code correctly. See point 11: How to help us help you - or How to ask a good question
However from looking at your unformatted code and the error, this is the likely culprit:
Capital letters in the friendly name are ok but not for the sensor id/name
platform: template
sensors:
KSEB: ### <------- Change this to lower case letters
value_template: "{{ states('sensor.phase_1_energy_power') | float + states('sensor.phase_2_energy_power') | float + states('sensor.phase_3_energy_power') | float }}"
entity_id:
- sensor.phase_1_energy_power
- sensor.phase_2_energy_power
- sensor.phase_3_energy_power
friendly_name: 'KSEB'
unit_of_measurement: 'Watt'
aslu
(Aslam)
June 14, 2019, 12:13pm
5
Thanks Tom,
Again i have error
Configuration invalidCHECK CONFIG
Error loading /config/configuration.yaml: mapping values are not allowed here in “/config/configuration.yaml”, line 35, column 10
Please help
Thanks & Regards,
Aslam
aslu
(Aslam)
June 14, 2019, 12:25pm
6
it worked like a charm.
config:
sensor:
platform: template
sensors:
kseb:
value_template: “{{ states(‘sensor.phase_1_energy_power’) | float + states(‘sensor.phase_2_energy_power’) | float + states(‘sensor.phase_3_energy_power’) | float }}”
entity_id:
- sensor.phase_1_energy_power
- sensor.phase_2_energy_power
- sensor.phase_3_energy_power
friendly_name: ‘kseb’
unit_of_measurement: ‘Watt’
Thanks for the support.
Aslam
tom_l
June 14, 2019, 12:26pm
7
You have an indentation problem at the line specified (or one above/below it).
Post your properly formatted code if you can’t spot it.
aslu
(Aslam)
June 14, 2019, 12:32pm
8
Hi Tom,
Yep, it was. corrected as follows.
sensor:
platform: template
sensors:
kseb:
value_template: “{{ states(‘sensor.phase_1_energy_power’) | float + states(‘sensor.phase_2_energy_power’) | float + states(‘sensor.phase_3_energy_power’) | float }}”
entity_id:
- sensor.phase_1_energy_power
- sensor.phase_2_energy_power
- sensor.phase_3_energy_power
friendly_name: ‘kseb’
unit_of_measurement: ‘Watt’
Now its working.
Thanks a lot.
Aslam
tom_l
June 14, 2019, 12:40pm
9
Great but you really need to work out how to format your posts properly. That tells us nothing.
Have a read of point 11 here: How to help us help you - or How to ask a good question
aslu
(Aslam)
June 15, 2019, 5:19am
10
Great.
I have a suggestion. There is no proper tutorial for the home assistant. All the documents are good but not for the beginners. If possible it will be great a video tutorial for those stuffs.
Thanks & Regards,
Aslam
tom_l
June 15, 2019, 5:24am
11
Yeah there is. Follow all the way through with this:
There are hundreds .
Search for what you specifically want to do with home assistant. Make sure you watch a recent one. Things are changing quickly at the moment.
2 Likes
Can a you please post a code snippet of your config? I’m not getting this to work . Been struggling for days now…
Edit, solved by using:
- platform: template
sensors:
energy_total:
friendly_name: 'Total Energy'
entity_id:
- sensor.shelly_bv1_power
- sensor.shelly_bv2_power
- sensor.shelly_bv3_power
value_template: "{{ (states('sensor.shelly_bv1_power')|float + states('sensor.shelly_bv2_power')|float + states('sensor.shelly_bv3_power')|float)|round(3) }}"
unit_of_measurement: "W"
2 Likes