Sensor.yaml file

Sorry for all the basic questions but I’m still learning

I don’t know what I’m doing wrong here, I have a configuration.yaml file with this

sensor: !include sensor.yaml

I then want to add the darksky and Synology into the sensor.yaml file

platform: darksky
    api_key: XXXXXXX
    monitored_conditions: 
      - summary
      - icon
      - nearest_storm_distance
      - nearest_storm_bearing
      - precip_type
      - precip_intensity
      - precip_probability
      - temperature
      - apparent_temperature
      - dew_point
      - wind_speed
      - wind_bearing
      - cloud_cover
      - humidity
      - pressure
      - visibility
      - ozone
      - minutely_summary
      - hourly_summary
      - daily_summary
      - temperature_max
      - temperature_min
      - apparent_temperature_max
      - apparent_temperature_min
      - precip_intensity_max
  
 platform: synologydsm
  host: 192.168.0.111
  username: XXXX
  password: XXXXX
  monitored_conditions:
  - cpu_total_load
  - memory_real_usage
  - disk_status
  - volume_status
  - volume_percentage_used
  - volume_disk_temp_max

But its the file is not valid and moaning about the platform statement, but no idea why

Could someone please help

I’m still trying to learn the format of a YAML file and struggling with the basics I think

Your spacing for darksky looks wrong. Spacing is important.
2 spaces, no tabs.

As @anon34565116 said, the spacing is off. But you’ll also need list indications. You have more than 1 platform and each platform needs a note that lets it know when the platform starts. The symbol that notes each section/platform is the - symbol. You can actually see it being used under monitored_conditions. It’s the same principle, it notes the start of a new item inside that indentation level.

Also, your spacing is off between each platform. It’s always best to keep everything in line. I.E. each time you need an indent, use 2 spaces.

  - platform: darksky
    api_key: XXXXXXX
    monitored_conditions: 
      - summary
      - icon
      - nearest_storm_distance
      - nearest_storm_bearing
      - precip_type
      - precip_intensity
      - precip_probability
      - temperature
      - apparent_temperature
      - dew_point
      - wind_speed
      - wind_bearing
      - cloud_cover
      - humidity
      - pressure
      - visibility
      - ozone
      - minutely_summary
      - hourly_summary
      - daily_summary
      - temperature_max
      - temperature_min
      - apparent_temperature_max
      - apparent_temperature_min
      - precip_intensity_max
  
  - platform: synologydsm
    host: 192.168.0.111
    username: XXXX
    password: XXXXX
    monitored_conditions:
      - cpu_total_load
      - memory_real_usage
      - disk_status
      - volume_status
      - volume_percentage_used
      - volume_disk_temp_max
1 Like

Thanks for the help but still struggling

- platform: darksky
  api_key: XXXXXXX
  monitored_conditions: 
    - summary
    - icon
    - nearest_storm_distance
    - nearest_storm_bearing
    - precip_type
    - precip_intensity
    - precip_probability
    - temperature
    - apparent_temperature
    - dew_point
    - wind_speed
    - wind_bearing
    - cloud_cover
    - humidity
    - pressure
    - visibility
    - ozone
    - minutely_summary
    - hourly_summary
    - daily_summary
    - temperature_max
    - temperature_min
    - apparent_temperature_max
    - apparent_temperature_min
    - precip_intensity_max
  
  - platform: synologydsm
    host: 192.168.0.200
    username: XXXX
    password: XXXXX
    monitored_conditions:
      - cpu_total_load
      - memory_real_usage
      - disk_status
      - volume_status
      - volume_percentage_used
      - volume_disk_temp_max

Like it says, line 30 column 3. Notice with 2 space indenting, the column number should be an even number. :wink:

Your indentation for synology is one space out which places it under the config of darksky. Backspace your synology platform one space for each line and you will be in business

1 Like

I was trying to teach them to look there for themselves & figure that out. :wink:

2 Likes

Teach a man to fish and all that :wink:

sorry to high jack this but i noticed in some other thread you were getting information out the ubiquiti’s WAPs. What were you using to get that info?

snmp but baseoid is different for different UBNT models you can grab the snmp from my repo or you may have to do an snmpwalk to find out which ones to use I’m pretty sure mine should work any airmax models.

1 Like

THANKS ALL!!!

I’m getting there and getting my head around this stuff

Got the file working, now onto the next problem :sunglasses:

Thanks again

3 Likes

FYI, I noticed your uptime value_templates have an error in them. You’re if statement checking if they are under a minute should be {%- if time < 6000 -%} instead of {%- if time < 60 -%}. The time that comes back from these things are in microseconds which you account for in all your other checks aside from that first one.

Also, if your interested, I condensed it a little bit for myself.

  - platform: snmp
    host: !secret unifi_bonus_switch
    name: Bonus Room Switch Uptime
    baseoid: 1.3.6.1.2.1.1.3.0
    value_template: >
      {%- set time = value | int // 100 %}
      {%- set minutes = ((time % 3600) // 60) %}
      {%- set minutes = '{}min'.format(minutes) if minutes > 0 else '' %}
      {%- set hours = ((time % 86400) // 3600) %}
      {%- set hours = '{}hr '.format(hours) if hours > 0 else '' %}
      {%- set days = (time // 86400) %}
      {%- set days = '{}d '.format(days) if days > 0 else '' %}
      {{ 'Less than 1 min' if time < 60 else days + hours + minutes }}
1 Like

Thanks will use your condensed version I probably should have you troll through all my templates and use your templating wizardry I think I could condense my templates by half in most instances. It is not my skill set am self taught I’m afraid and I go for the “it only has to work” mantra with templates.

I love the way you layout crap in your UI. I’m not inventive enough with this. I’ll share my config with you later on. It may save you some time in the future. You could really make use of yaml anchors.

1 Like