Skip to content

Instantly share code, notes, and snippets.

@chpego
Created March 8, 2021 07:46
Show Gist options
  • Save chpego/cc0bdcf1d4475d1b2247b80393f24743 to your computer and use it in GitHub Desktop.
Save chpego/cc0bdcf1d4475d1b2247b80393f24743 to your computer and use it in GitHub Desktop.
tablette.yaml
---
automation:
- alias: "[System] - Chargement Tablette"
trigger:
- platform: numeric_state
entity_id: sensor.tablette_info
attribute: batteryLevel
above: 0
below: 6
- platform: state
entity_id: sensor.tablette_info
attribute: batteryLevel
to: 100
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.tablette_info
attribute: batteryLevel
above: 0
below: 6
sequence:
- service: switch.turn_on
entity_id: switch.XXXXXXXXX
- conditions:
- condition: state
entity_id: switch.XXXXXXXXX
state: "on"
- condition: numeric_state
entity_id: sensor.tablette_info
attribute: batteryLevel
above: 99
sequence:
- service: switch.turn_off
entity_id: switch.XXXXXXXXX
sensor:
- platform: rest
name: tablette_info
resource: !secret rest_url_kiosk_device_info
json_attributes:
- batteryLevel
- isPlugged
value_template: "OK"
scan_interval: 300
secret:
rest_url_kiosk_device_info: 'http://NOM-OU-ADRESSE-IP:2323/?cmd=deviceInfo&type=json&password=XXXXXXXXX'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment