Raspberry Pi Power Sensor (updated: 2018-07-25) / Use Github for reports in the future

I don’t think that’s going to work. It’s not even showing in my automation list. I think it’s no longer a valid numeric state. Might need 2 sensors still??

OK… PEBKAK… LOVELACE doesn’t have all automations by default and I needed to manyally add it there. Sigh.

I think maybe this:

- id: '1532478833426'
  alias: Power Problem Notification
  trigger:
  - above: '0'
    entity_id: sensor.rpi_power_status
    platform: numeric_state
    value_template: '{{ state.attributes.value }}'
  condition: []
  action:
  - data:
      message: "Warning, currently your raspberry pi is status {{ states.sensor.rpi_power_status.attributes.value }} and {{ states.sensor.rpi_power_status.state }}."
    service: notify.notify

I followed the format of an automation for the sun that tracks the elevation of below 25 and the 25 was in quotes @ludeeus

You need to change data to data_template when it includes a template for it to render

Thanks for that…

However, it is working as is if I manually trigger the automation.

See this is one thing I find incredibly confusing. I can’t seem to find any good documentation on templates etc.

For instance, you said up above before that for a number 0 I should not put quotes around it. But the inbuilt automation editor put the quotes in in the first place! I also have another automation that uses numeric_state and it seems fine also with it in ‘0’ quotes.

Also, it seems sometimes, it can be either single or double quotes (or even no quotes) but there don’t seem to be any rules about where to use which!

Also with value_template… sometimes it’s written as:

value_template: >

sometimes

value_template: >-

It’s just confusing and I’d love to read up on it and understand best practices.

But the inbuilt automation editor put the quotes in in the first place!

If that is true you should open an issue for that :wink:

Also, it seems sometimes, it can be either single or double quotes (or even no quotes) but there don’t seem to be any rules about where to use which!

If the key: expects a string and that string only contain alphanumeric characthers, there is no need for quotes.

For templates that you have on 1 line like:

value_template: "{{ state('sensor.my_sensor') }}"

You want to use doubble " at the start and beginning and single ' inside.
why? it looks SO much cleaner that the other way :wink:

The difference between > and >- there is the >- removes whitespaces.
I personally prefer to use >-

ok so with this automation:

- id: '1505977024304'
  alias: Turn Lounge Light On Elevation < 25° & after 4PM
  trigger:
  - below: '25'
    entity_id: sun.sun
    platform: numeric_state
    value_template: '{{ state.attributes.elevation }}'
  - platform: time
    at: '16:00:00'
  condition:
  - after: '16:00:00'
    before: '22:00:00'
    condition: time
  - condition: template
    value_template: '{{states.sun.sun.attributes.elevation < 25}}'
  action:
  - service: light.turn_on
    data:
      brightness_pct: 75
      entity_id: light.lounge
      kelvin: 3100

the after ‘16:00:00’ and before are in quotes but they should NOT have quotes and the below ‘25’ is in quotes but it shouldn’t be because it is a number?

Yet it’s working as is as well?

Your times needs quotes becouse they contain :
The below does not need it, but you can use it, HA should convert the content to int, this is may not be valid for other systems

1 Like

ok duh! a : is not an alpha-numeric character. (I misread/misunderstood so that makes more sense now)

but what’s the difference between:

below: '25'

and

above: '0'

because you are indicating the above one should NOT have quotes? Incidentally, the ‘0’ automation trigger isn’t tested (damn my awesome power supply)… again just trying to understand.

I’m enjoyoing t his conversation because I agree the documentation could do with formalising and bringing together. (Thanks @ludeeus for some interesting info).

But as far as this goes don’t forget that you can use the States page of the Developer Tools to force a state for testing.

I have this in my configuration file but HA loads the components in random order. Needles to say that my automations doesn’t work. I tried placing some other sensors in between but didn’t have any effect.

I never understood what is the actual benefit adding it twice and not creating the template sensor?

Awesome component btw! Thank you for the creators!

This looks like a good sensor includes in the main HomeAssistant release, it would be really handy for solving RPi power issues.

1 Like

at the moment im content with having it as a custom component, but im not ruling out a official submission.

@toast
With the release of .88, is there any modification required to comply with the breaking changes?

yepp there was a patch submitted for 0.88 so it complies with the breaking change, tnx @balloob for all the breaking changes as of late

hopfully thats the only breaking change.

Toast, that remark is uncalled for. If you don’t like breaking changes, don’t upgrade.

2 Likes

interesting things are beeing removed do i have to move on to things you don’t have your hands in so you can’t censor it?

great advice… not to upgrade because someone decided to break stuff… not.
I can totally understand toasts disappointment with this.

Closing this topic.

Home Assistant is a community of people that care about home automation and we are all volunteers working hard on making this possible.

I’m not going to let people take our work for free and then come and harass us. Spend your time like you wish, don’t belittle us for what we do. That behavior does not belong in any part of this community.

7 Likes