EightEFI

Untitled

Oct 6th, 2024 (edited)
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.72 KB | Source Code | 0 0
  1. Automations.yaml
  2.  
  3. - alias: Poltin käyntilaskuri
  4.   description: ''
  5.   trigger:
  6.   - type: current
  7.     platform: device
  8.     device_id: cf5ec48178ef20d2e03cdecb87e80bad
  9.     entity_id: 785ffb3ae4173af4103375b7438f16ae
  10.     domain: sensor
  11.     above: 0.2
  12.     for:
  13.       hours: 0
  14.       minutes: 0
  15.       seconds: 2
  16.   condition: []
  17.   action: []
  18.   mode: single
  19. - alias: Add Oil Automation
  20.   description: ''
  21.   trigger:
  22.   - platform: state
  23.     entity_id:
  24.    - input_number.add_oil_amount
  25.   condition: []
  26.   action:
  27.   - service: input_number.set_value
  28.     data_template:
  29.       value: '{{ states(''input_number.add_oil_amount'') |float + states(''input_number.oil_remaining'')
  30.         |float}}'
  31.       entity_id: input_number.oil_remaining
  32.   - delay:
  33.       hours: 0
  34.       minutes: 0
  35.       seconds: 1
  36.       milliseconds: 0
  37.   - service: input_number.set_value
  38.     data:
  39.       value: 0
  40.     target:
  41.       entity_id: input_number.add_oil_amount
  42.   mode: single
  43. - alias: Öljyn kulutus automaattinen vähennys
  44.   description: ''
  45.   triggers:
  46.   - trigger: state
  47.     entity_id:
  48.    - binary_sensor.oljypoltin_tila
  49.     from: 'off'
  50.     to: 'on'
  51.   conditions: []
  52.   actions:
  53.   - repeat:
  54.       sequence:
  55.       - action: input_number.set_value
  56.         target:
  57.           entity_id: input_number.oil_remaining
  58.         data:
  59.           value: > '{{ ( states(''input_number.oil_remaining'') | float - (states(''input_number.oil_consumption_per_h'')
  60.             | float / 60) ) | round(3, default=0) }}'
  61.       - delay:
  62.           hours: 0
  63.           minutes: 1
  64.           seconds: 0
  65.           milliseconds: 0
  66.       until:
  67.       - condition: state
  68.         entity_id: binary_sensor.oljypoltin_tila
  69.         state: 'off'
  70.   mode: single
  71.  
Advertisement
Add Comment
Please, Sign In to add comment