AllHailJ
(J Gent)
February 11, 2022, 3:24pm
21
I use min max
sensor:
- platform: min_max
name: "Main Floor Average Temperature"
type: mean
round_digits: 1
entity_ids:
- sensor.multisensor_6_air_temperature
- sensor.kitchen_flood_sensor_air_temperature_2
- sensor.main_floor_temperature
- sensor.mil_bath_leak_sensor_air_temperature_2
- sensor.mud_room_fibaro_air_temperature_2
1 Like
bschatzow
(Bill Schatzow)
February 20, 2022, 2:21am
22
I have very similar code and I am getting unknown error when I look at it in developers tools.
My code is:
sensor:
- platform: min_max
entity_ids:
- sensor.17_seaview_avenue_current_temp
- sensor.dark_sky_current_temp
- sensor.tasmota_outside_temp_ds18b20_temperature_2
type: mean
round_digits: 1
name: Outside_Aveage_Temp
All three of the sensors give a reading in developers tools. Any ideas how to troubleshoot this?
Mine now works.
The issue I had was the default unit of measure on the template sensors was different.
got a question on this… (hoping I just missed something in my config…)
I am getting a phantom watt reading when all lights are off:
Here’s my template for this:
and when some of the lights are on…
… Also noticed even when a bulb is “OFF”, it shows a reading of 0.4 W (is this my issue and maybe just a residue/discharge of energy for zigbee?)
finity
May 24, 2022, 9:14am
24
I would assume it’s from the power draw of the smart plug itself (radio, LED, etc). Commonly called “vampire load”.
Stratus
(Home Assistant)
July 29, 2023, 9:09pm
25
I know this is a bit of a necro but I wanted to say thanks! This was the best example I found for this, and is still relevant in 2023.
Cheers!
My Yaml template cannot being used as it’s a non-numeric value
My code is like this:
template:
- sensor:
- name: "current_power_usage"
unit_of_measurement: "W"
device_class: power
state: >
{{ [ states('sensor.phase_a_power')| float(0) +
states('sensor.phase_b_power')| float(0) +
states('sensor.phase_c_power')| float(0) +
states('sensor.envoy_solar_panels_current_power_production')| float(0)] }}
availability: >
{{ not 'unavailable' in
[ states('sensor.phase_a_power'),
states('sensor.phase_b_power'),
states('sensor.phase_c_power'),
states('sensor.envoy_solar_panels_current_power_production')] }}
It’s probably simple, but what can I do to use it in a Gauge?
Because you’re returning a list…
state: >
{{ states('sensor.phase_a_power')| float(0) +
states('sensor.phase_b_power')| float(0) +
states('sensor.phase_c_power')| float(0) +
states('sensor.envoy_solar_panels_current_power_production')| float(0) }}
EngbertT
(Engbert Tienkamp)
August 6, 2023, 4:12pm
28
ardysusilo:
Yes. The format should look like the following-
template:
- sensor:
- name: "Total Charging Power"
unit_of_measurement: "W"
device_class: power
state: >
{{ [ states('sensor.inverter1qpigs_pv1_charging_power'),
states('sensor.inverter2qpigs_pv1_charging_power') ]
| map('float') | sum }}
availability: >
{{ not 'unavailable' in
[ states('sensor.inverter1qpigs_pv1_charging_power'),
states('sensor.inverter2qpigs_pv1_charging_power') ] }}
- name: "xxxx"
unit_of_measurement: "W"
device_class: power
state: >
{{ [ states('sensor.xyz'),
states('sensor.abc') ]
| map('float') | sum }}
availability: >
{{ not 'unavailable' in
[ states('sensor.xyz'),
states('sensor.abc') ] }}
Application of this format generated this errormessage in dev_tools:
ValueError: Template error: float got invalid input 'unknown' when rendering template
template:
-sensor:
- name: "Total Charging Power"
unit_of_measurement: "W"
device_class: power
state: >
{{ [ states('sensor.sessy_d5mr_charge_power' ),
states('sensor.sessy_dma4_charge_power' )]
| map('float') | sum }}
availability: >
{{ not 'unavailable' in
[ states('sensor.sessy_d5mr_charge_power'),
states('sensor.sessy_dma4_charge_power') ] }}'
but no default was specified.
How to solve?
Or just an initialisation issue?
map('float', default=0)
You should start a new topic in future for new issues.
Cool, thanks.
In case you missed it: I did give you the solution in my previous message. You just need to provide a default.
You could use Group helper and add the sensors you want, chose Sum as type and it will add all of the entities values together.
Updated easy way to add multiple sensors without editing the configuration.yaml file is create a helper in Settings > Devices > Helpers > Create Helper and choose type: “Combine the state of several sensors”. Then choose the option of “sum” then add in the entities.
1 Like