Min/max sensor with more than one entires in my yaml

Can anybody help how I can get more than one min/max sensor. Created a minmax.yaml with:

platform: min_max
sensors:
  waerme:
# type: min, max or mean
  type: mean
  entity_ids:
    - sensor.fibaro_buero_temperature
    - sensor.fibaro_gang_temperature
    - sensor.fibaro_wohnzimmer_temperature
    - sensor.fibaro_kueche_temperature
    - sensor.fibaro_schlafzimmer_temperature
  - sensor.vision_multisensor_bad_temperature
  wohnzimmer_waerme:
# type: min, max or mean
  type: mean
  entity_ids:
    - sensor.fibaro_wohnzimmer_temperature
    - sensor.wohnzimmer_thermostat_temp_rechts
    - sensor.wohnzimmer_thermostat_temp_links
    - sensor.wohnzimmer_wand_temp
  buero_waerme:
# type: min, max or mean
  type: mean
  entity_ids:
     - sensor.fibaro_buero_temperature
     - sensor.buero_wand_temp
     - sensor.buero_thermostat_temp
  kueche_waerme:
# type: min, max or mean
  type: mean
  entity_ids:
    - sensor.fibaro_kueche_temperature
  bad_waerme:
# type: min, max or mean
  type: mean
  entity_ids:
    - sensor.vision_multisensor_bad_temperature
    - sensor.bad_wand_temp
    - sensor.bad_thermostat_temp
  schlafzimmer_waerme:
# type: min, max or mean
  type: mean
  entity_ids:
    - sensor.fibaro_schlafzimmer_temperature
    - sensor.schlafzimmer_wand_temp
    - sensor.schlafzimmer_thermostat_temp
  gang_waerme:
# type: min, max or mean
  type: mean
  entity_ids:
   - sensor.fibaro_gang_temperature

all I got @ startup:

Oct 31 22:29:01 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "type". Check lines 4 and 14.
Oct 31 22:29:01 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "entity_ids". Check lines 5 and 15.
Oct 31 22:29:01 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "type". Check lines 14 and 22.
Oct 31 22:29:01 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "entity_ids". Check lines 15 and 23.
Oct 31 22:29:01 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "type". Check lines 22 and 29.
Oct 31 22:29:01 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "entity_ids". Check lines 23 and 30.
Oct 31 22:29:01 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "type". Check lines 29 and 34.
Oct 31 22:29:02 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "entity_ids". Check lines 30 and 35.
Oct 31 22:29:02 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "type". Check lines 34 and 41.
Oct 31 22:29:02 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "entity_ids". Check lines 35 and 42.
Oct 31 22:29:02 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "type". Check lines 41 and 48.
Oct 31 22:29:02 home-assistant hass[5509]: 2017-10-31 22:29:01 ERROR (Thread-2) [homeassistant.util.yaml] YAML file /home/homeassistant/.homeassistant/sensor/min_max.yaml contains duplicate key "entity_ids". Check lines 42 and 49.
Oct

How can I create more than one minmax sensor in my yaml file?

put the above for each sensor :slight_smile:

1 Like

Solved !
what I did was entering

  - name: waerme
    platform: min_max


  - name: waerme
    platform: min_max
# type: min, max or mean
    type: mean
    entity_ids:
      - sensor.fibaro_buero_temperature
      - sensor.fibaro_gang_temperature
      - sensor.fibaro_wohnzimmer_temperature
      - sensor.fibaro_kueche_temperature
      - sensor.fibaro_schlafzimmer_temperature
      - sensor.vision_multisensor_bad_temperature
  - name: wohnzimmer_waerme
    platform: min_max
# type: min, max or mean
    type: mean
    entity_ids:
      - sensor

but … it throws a:

Nov 01 11:36:38 home-assistant hass[13847]: 2017-11-01 11:36:38 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor]: expected a dictionary. Got OrderedDict([('homeassistant', OrderedDict([('name', 'home'), ('latitude', 48.057583256876), ('longitude', 10.488373944785), ('elevation', 607), ('unit_system', 'metric'), ('time_zone', 'Europe/Berlin')])), ('duckdns', OrderedDict([('domain', 'ihaus'), ('access_token', 'dddd')])), ('alexa', {}), ('emulated_hue', OrderedDict([('host_ip', '192.168.1.80'), ('listen_port', 8300), ('off_maps_to_on_domains', ['script']), ('expose_by_default', True), ('exposed_domains.... (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor/
Nov 01 11:36:40 home-assistant hass[13847]: 2017-11-01 11:36:40 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_call_id=1972164400-1, domain=persistent_notification, service=create, service_data=title=Invalid config, notification_id=invalid_config, message=The following components and platforms could not be set up:
Nov 01 11:36:40 home-assistant hass[13847]: Please check your config; title=Invalid config @ 2017-11-01T11:36:40.764289+01:00>, entity_id=persistent_notification.invalid_config, old_state=None> 

have to remove my whole minmax.yaml file to get the sensors working again. Any Idee how to fix?

Is not a valid entity_id.

Thanks Fabaff,
this was just a snipe of a longer yaml. the Sensor itself does not stand alone

Try it like below:

  - platform: min_max
    entity_ids:
      - sensor.fibaro_buero_temperature
      - sensor.fibaro_gang_temperature
      - sensor.fibaro_wohnzimmer_temperature
      - sensor.fibaro_kueche_temperature
      - sensor.fibaro_schlafzimmer_temperature
      - sensor.vision_multisensor_bad_temperature
    name: waerme
    type: mean

Folks,
that is all great and working. What I am trying to archive is getting a 2nd min max sensor into the same yaml file and this is failing.
my min-max.yaml looks today:

platform: min_max
entity_ids:
      - sensor.fibaro_buero_temperature
      - sensor.fibaro_gang_temperature
      - sensor.fibaro_wohnzimmer_temperature_2
      - sensor.fibaro_kueche_temperature
      - sensor.fibaro_schlafzimmer_temperature
      - sensor.vision_multisensor_bad_temperature
name: durchschnittstemperatur
type: mean

How can I add another one into the same yaml file?

If you have them in sensors.yaml file they should look like this…

- platform: min_max
  entity_ids:
    - sensor.miflora_bird_of_paradise_temperature
    - sensor.miflora_flowering_fern_temperature
    - sensor.miflora_volcano_fern_temperature
  name: avglroomtemp
  type: mean

- platform: min_max
  entity_ids:
    - sensor.miflora_bird_of_paradise_light_intensity
    - sensor.miflora_flowering_fern_light_intensity
    - sensor.miflora_volcano_fern_light_intensity
  name: avglroomlux
  type: mean

Your spacing looks a little off :slight_smile:

I do have serveral yaml below the sensor directory

-rwxrwxrwx 1 root          root           4096 Oct 19 13:27 ._command_line.yaml
-rwxrwxrwx 1 root          root            195 Oct  3 10:12 command_line.yaml
-rwxrwxrwx 1 root          root             54 Apr 14  2017 Deutsche Bahn.yaml
-rwxrwxrwx 1 root          root             92 Aug 28 16:18 dht.yaml
-rwxrwxrwx 1 root          root            267 Oct 20 20:14 fritzbox_callmonitor.yaml
-rwxrwxrwx 1 root          root            136 Aug 30 15:10 google_travel_time.yaml
-rwxrwxrwx 1 root          root           4096 Nov  9 14:31 ._min-max.yaml
-rwxrwxrwx 1 root          root            359 Nov  9 16:26 min-max.yaml
-rwxrwxrwx 1 root          root             83 Oct 20 21:23 onewire.yaml
-rwxrwxrwx 1 root          root            132 Aug  3 16:07 speedtest.yaml
-rwxrwxrwx 1 root          root            211 Oct 29 08:12 systemmonitor.yaml
-rwxrwxrwx 1 root          root          13478 Nov  8 23:11 template.yaml
-rwxrwxrwx 1 root          root             66 Apr 14  2017 time_date.yaml
-rwxrwxrwx 1 root          root             52 Apr 14  2017 worldclock.yaml
-rwxrwxrwx 1 root          root             85 Apr 14  2017 wunderground.yaml
-rwxrwxrwx 1 root          root            537 Oct 19 13:18 yr.yaml

What I am looking for is how the min-max.yaml syntax will look like

It looks exactly how I pasted it, it comes directly from my sensors.yaml file which is included via

sensor: !include sensors.yaml

No spaces at the front :slight_smile:

Please use the </> in the edit box after selecting your code to format it for use here, then we can see what’s wrong with it.

I do have a

sensor: !include_dir_list sensor

configured into my configuration yaml.

now when I add the following lines into my min-max.yaml

- platform: min_max
  entity_ids:
         - sensor.fibaro_buero_temperature
         - sensor.fibaro_gang_temperature
  name: avglroomtemp
  type: mean

- platform: min_max
  entity_ids:
         - sensor.fibaro_buero_temperature
         - sensor.fibaro_gang_temperature
         - sensor.fibaro_wohnzimmer_temperature_2
         - sensor.fibaro_kueche_temperature
         - sensor.fibaro_schlafzimmer_temperature
         - sensor.vision_multisensor_bad_temperature
  name: avglroomlux
  type: mean

it says:

2017-11-09 19:55:29 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor]: expected a dictionary. Got OrderedDict([('homeassistant', OrderedDict([('name', 'home'), ('latitude', yy.05753256876), ('longitude', xx.8373944785), ('elevation', xyz), ('unit_system', 'metric'), ('time_zone', 'Europe/Berlin')])), ('duckdns', OrderedDict([('domain', '<dom>'), ('access_token', 'token7')])), ('alexa', {}), ('emulated_hue', OrderedDict([('host_ip', '192.168.1.80'), ('listen_port', 8300), ('off_maps_to_on_domains', ['script']), ('expose_by_default', True), ('exposed_domains.... (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor/

To use that format for your sensors, you should use include_dir_merge_list. Also, you’ve got way too many spaces before your entity_ids.

sensor: !include_dir_merge_list sensor
- platform: min_max
  entity_ids:
    - sensor.fibaro_buero_temperature
    - sensor.fibaro_gang_temperature
  name: avglroomtemp
  type: mean

- platform: min_max
  entity_ids:
    - sensor.fibaro_buero_temperature
    - sensor.fibaro_gang_temperature
    - sensor.fibaro_wohnzimmer_temperature_2
    - sensor.fibaro_kueche_temperature
    - sensor.fibaro_schlafzimmer_temperature
    - sensor.vision_multisensor_bad_temperature
  name: avglroomlux
  type: mean
1 Like