#Sensor Question

1 messages · Page 1 of 1 (latest)

slim jolt
#

@south spear Let's post this here and see what you need. I hate Hastebin...

#

Hello guys! I want to modify Blueprint from https://gist.github.com/sbyx/1f6f434f0903b872b84c4302637d0890
New Blueprint need to Notify about sensors that added where temperature exceed threshold. But i cant recreate trigger that check changes on fly. Can someone help with advice?

variables:
  day: !input 'day'
  temperatur: !input 'temperatur'
  include: !input 'include'
  sensors: "{% set result = namespace(sensors=[]) %}
{% for state in states.sensor | selectattr('attributes.unit_of_measurement', '==', '?C') %} 
{% if states(state.entity_id) | int > temperatur and state.entity_id in include.entity_id %}
{% set result.sensors = result.sensors + [state.name ~ ' (' ~ states(state.entity_id) ~ ' ?C)'] %} 
{% endif %} {% endfor %}
{{ result.sensors | join(', <BR>') }}"

trigger:
- platform: template
  value_template: "{{(result.sensors | count)>1}}"
condition:
- '{{ sensors != ''''}}'
action:
- choose: []
  default: !input 'actions'
mode: single
#

So the base blueprnt is:

  name: Low battery level detection & notification for all battery sensors
  description: Regularly test all sensors with 'battery' device-class for crossing
    a certain battery level threshold and if so execute an action.

And yours has nothing to do with that...

south spear
#

i can

slim jolt
#

If you are trying to make a new blueprint, I have some advice.

#

You SHOULD first write an automation that does exactly what you want to achieve then plug in the stuff to make it a blueprint. Getting the logic working is not always easy, and becomes obfuscated in all that variable substitution stuff, making everything frustrating.
Get what you want working, then make the blueprint out of that by adding the !inputs and variables and such.

There are generally 2 reasons to make a blueprint.

  1. because you want to do the same thing multiple times, like my script blueprint to talk to my broadlink and program buttons to turn on and off my AV equipment. I have re-used that script blueprint about a dozen times in my config. T
  2. You are doing something you think is cool and you want to share it with others.
    If you are doing something only once, the blueprint only complicates things for you.
south spear
#

yes, im talking about new blueprint. for now new blueprint cant check picked temperature sensors and send notification if temperature exceed limit but trigger by time. i cant realize logic for trigger to automate checking on fly... i thinks use template in trigger and check variable count but this not working...☹️

slim jolt
#

Do you have this working as an automation using a single set of sample entities to get the logic working?

#

IE, my message above

south spear
#

not yet, but I will take your advice for implementation as soon as I get to the computer

slim jolt
#

After you get the logic sound, there are some tricks to the jinga2 template stuff that you can look in the main #blueprints-archived channel pins 📌 at the top and that may help you. Also look at my 5-button blueprint.

#

OK, check back when you have more questions. feel free to tag me.

south spear
#

thanks for the advice, it will be helpful in learning Blueprint ...

south spear
#

sorry, was busy

#

i can do automation without blueprint, but then i need setting up all entities.

#

alias: aaaa New Automation
description: ''
trigger:

  • platform: numeric_state
    entity_id: sensor.sm_m_livingroom_light_device_temperature
    above: '30'
  • platform: numeric_state
    entity_id: sensor.sh_m_bedroom_light_device_temperature
    above: '30'
    condition: []
    action:
  • service: persistent_notification.create
    data:
    message: temp exceed
    mode: single
#

i want to do blueprint where i can set temp threshold, device list by template (all devices where attribute is temperature) + device exclude list.

slim jolt
#

OK