Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


peejayw

1839 posts

Uber Geek


#305911 13-Jun-2023 11:28
Send private message

Because I had a spare Aqara door sensor I thought this project would add to my weather data nicely but my yaml knowledge consists of "cut and paste" and after that I am floundering.

 

I have manged to get the first sensor pasted into my config file but when I try to do the second one I get all sorts of errors, bad indentation etc and it affects other subsequent entries in the config file as well.

 

Clearly I am missing some essential skill here, I wonder if anyone could suggest how to get it working? I have the actual hardware all set up and that is showing when the bucket tips so I am happy with that.

 

Thanks.





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


Filter this topic showing only the reply marked as answer View this topic in a long page with up to 500 replies per page Create new topic
 1 | 2
mkissin
386 posts

Ultimate Geek

ID Verified

  #3089366 13-Jun-2023 11:51
Send private message

YAML is incredibly picky about formatting. You may just need to run your config through a YAML validator like Best YAML Validator Online (jsonformatter.org)


 
 
 
 

Shop now for Lenovo laptops and other devices (affiliate link).
timmmay
20429 posts

Uber Geek

Trusted
Lifetime subscriber

  #3089373 13-Jun-2023 12:24
Send private message

If you can't get it working put your YAML somewhere and I'll take a crack at it. I'm not an expert, I use YAML fairly often but still find it odd. Make sure your YAML uses spaces rather than tabs.


peejayw

1839 posts

Uber Geek


  #3089445 13-Jun-2023 13:23
Send private message

mkissin:

 

YAML is incredibly picky about formatting. You may just need to run your config through a YAML validator like Best YAML Validator Online (jsonformatter.org)

 

 

Thanks, I will give that a try. Is there a way to make a backup of my config file that preserves the formatting so I can restore it if things get too messed up?





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.




timmmay
20429 posts

Uber Geek

Trusted
Lifetime subscriber

  #3089447 13-Jun-2023 13:38
Send private message

You can backup your config within home assistant gui. Settings, System, Backups. I run HA Core so I have OS access and run Restic to back up the HA configuration file / automations / everything else nightly with Restic.


peejayw

1839 posts

Uber Geek


  #3089456 13-Jun-2023 13:44
Send private message

Thanks but I couldnt see how to choose the config file to backup. Never mind, I have it now, how can I get it to you ?

 

 





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


Silvrav
443 posts

Ultimate Geek

ID Verified

  #3089467 13-Jun-2023 14:20
Send private message

peejayw:

 

mkissin:

 

YAML is incredibly picky about formatting. You may just need to run your config through a YAML validator like Best YAML Validator Online (jsonformatter.org)

 

 

Thanks, I will give that a try. Is there a way to make a backup of my config file that preserves the formatting so I can restore it if things get too messed up?

 

 

Are you referring to the config yaml? best is to samba share in and copy and paste it or go to file editor and download the file for safe keeping.


timmmay
20429 posts

Uber Geek

Trusted
Lifetime subscriber

  #3089475 13-Jun-2023 14:51
Send private message

If your configuration isn't working you won't be able to get it from the web interface as the web interface won't be working. I don't really understand what the is if your config is working and you want to send it to be looked at.

 

Try formatting your YAML in the tool above, if you can't work it out put it into pastebin or similar and post the link here.




peejayw

1839 posts

Uber Geek


  #3089480 13-Jun-2023 14:57
Send private message

Because my config file got messed up I had to do a full HA restore, I was trying to find out if there was a way to just back up and restore the config file without doing a full restore to save time.

Here is the link to the config file.

https://drive.google.com/file/d/1w8pNR7ZBLRaCFNffxgl_vIsTMFssJUrw/view?usp=sharing





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


timmmay
20429 posts

Uber Geek

Trusted
Lifetime subscriber

  #3089481 13-Jun-2023 14:58
Send private message

Access denied. There are many ways to set up Home Assistant, it depends how / where it runs.


peejayw

1839 posts

Uber Geek


  #3089483 13-Jun-2023 15:03
Send private message

Sorry, forgot to set access, should work now.

https://drive.google.com/file/d/1w8pNR7ZBLRaCFNffxgl_vIsTMFssJUrw/view?usp=sharing





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


timmmay
20429 posts

Uber Geek

Trusted
Lifetime subscriber

  #3089488 13-Jun-2023 15:14
Send private message

Once you remove all the "include" directives that the YAML validator tool doesn't like your YAML validates fine using the tool above.


peejayw

1839 posts

Uber Geek


  #3089562 13-Jun-2023 16:21
Send private message

Yes, thats my current yaml config file which works fine. The issue is when I attempt to incorporate the additions for the rain gauge, then it gets all screwed up.

 

 





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


timmmay
20429 posts

Uber Geek

Trusted
Lifetime subscriber

  #3089563 13-Jun-2023 16:25
Send private message

Perhaps you could share the sample code that doesn't work?

peejayw

1839 posts

Uber Geek


  #3089568 13-Jun-2023 17:03
Send private message

Well I have managed to incorporate the example code in my config.yaml and it is not showing any errors so progress!

 

However "sensor.rainfall_today" shows as unavailable and I cant see any "sensor.rain_flips"

 

I think Im getting close, appreciate any further suggestions.





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


peejayw

1839 posts

Uber Geek


  #3089569 13-Jun-2023 17:06
Send private message

timmmay: Perhaps you could share the sample code that doesn't work?

 

This

 

 

 - platform: history_stats

 

    name: Rainsensor flips

 

    entity_id: switch.binary_sensorrainsensor_on_off_switch #The aqara sensor

 

    state: 'off'

 

    type: count

 

    start: '{{ now().replace(hour=0, minute=0, second=0) }}'

 

    end: '{{ now() }}'

 

 

 

and this

 

 

 

 

 

template:

 

    - sensor:

 

      - name: Rainfall today

 

        unit_of_measurement: mm

 

        state_class: total_increasing

 

        unique_id: rainfall_today

 

        state: >-

 

          {% set count = states('sensor.rainsensor_flips') | int(0) %}

 

          {% set mm = count * 0.30303 %}

 

          {% if count >= 0 %}

 

            {{ mm|round(1, 'floor') }}

 

          {% endif %}

 

        # If you have issues with the history sensor doubling after restarting HA, add the line below (@BigG)

 

        availability: "{{ (states('sensor.rainsensor_flips') not in ('unknown', 'unavailable')) }}"

 

 

 





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


 1 | 2
Filter this topic showing only the reply marked as answer View this topic in a long page with up to 500 replies per page Create new topic





News and reviews »

Logitech Introduces New G522 Gaming Headset
Posted 21-May-2025 19:01


LG Announces New Ultragear OLED Range for 2025
Posted 20-May-2025 16:35


Sandisk Raises the Bar With WD_BLACK SN8100 NVME SSD
Posted 20-May-2025 16:29


Sony Introduces the Next Evolution of Noise Cancelling with the WH-1000XM6
Posted 20-May-2025 16:22


Samsung Reveals Its 2025 Line-up of Home Appliances and AV Solutions
Posted 20-May-2025 16:11


Hisense NZ Unveils Local 2025 ULED Range
Posted 20-May-2025 16:00


Synology Launches BeeStation Plus
Posted 20-May-2025 15:55


New Suunto Run Available in Australia and New Zealand
Posted 13-May-2025 21:00


Cricut Maker 4 Review
Posted 12-May-2025 15:18


Dynabook Launches Ultra-Light Portégé Z40L-N Copilot+PC with Self-Replaceable Battery
Posted 8-May-2025 14:08


Shopify Sidekick Gets a Major Reasoning Upgrade, Plus Free Image Generation
Posted 8-May-2025 14:03


Microsoft Introduces New Surface Copilot+ PCs
Posted 8-May-2025 13:56


D-Link A/NZ launches DWR-933M 4G+ LTE Cat6 Wi-Fi 6 Mobile Hotspot
Posted 8-May-2025 13:49


Synology Expands DiskStation Lineup with DS1825+ and DS1525+
Posted 8-May-2025 13:44


JBL Releases Next Generation Flip 7 and Charge 6
Posted 8-May-2025 13:41









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.







Backblaze unlimited backup