Last active
April 21, 2019 11:44
-
-
Save ophilips/3375101ee2990d781350761d3053dc23 to your computer and use it in GitHub Desktop.
Control Iiyama X4071 Brightness with Home Assistant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
binary_sensor: | |
- platform: command_line | |
name: Monitor Status | |
command: ( /bin/echo -en "1048_b{{'%03d'%states.input_number.iiyama.state|int}}{{'\r'}}" > /dev/ttyUSB0 & timeout 2 /bin/cat < /dev/ttyUSB0 | /bin/grep -oP "1048_b" ; /bin/echo "off" ) | head -n 1 | |
payload_on: "1048_b" | |
payload_off: "off" | |
scan_interval: 10 | |
input_boolean: | |
iiyama: | |
input_number: | |
iiyama: | |
min: 0 | |
max: 100 | |
light: | |
- platform: template | |
lights: | |
iiyama: | |
friendly_name: "Monitor" | |
icon_template: mdi:television | |
value_template: "{{ is_state('binary_sensor.monitor_status', 'on') }}" | |
level_template: "{{ (states.input_number.iiyama.state|float/100*255)|int }}" | |
turn_on: | |
service: input_boolean.turn_on | |
entity_id: input_boolean.iiyama | |
turn_off: | |
service: input_boolean.turn_off | |
entity_id: input_boolean.iiyama | |
set_level: | |
service: input_number.set_value | |
data_template: | |
value: "{{ brightness/255*100 }}" | |
entity_id: input_number.iiyama |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment