It’s part of a package, here is the entire thing:
#-------------------------------------------
# Legrand Adorne MR232 Lighting Control
# legrand_mr232_lighting_control.yaml
#-------------------------------------------
###################################################################
# Shell Command #
###################################################################
shell_command:
###############################################################
# System #
###############################################################
restart_legrand_mr232: /bin/echo -e "VER\r" | netcat 192.168.0.49 4999 -w2
###############################################################
# Master Bedroom - Room 0001 #
###############################################################
master_bedroom_lights_0: /bin/echo -e "RAMPR,1,0,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_10: /bin/echo -e "RAMPR,1,26,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_20: /bin/echo -e "RAMPR,1,51,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_30: /bin/echo -e "RAMPR,1,77,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_40: /bin/echo -e "RAMPR,1,102,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_50: /bin/echo -e "RAMPR,1,128,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_60: /bin/echo -e "RAMPR,1,153,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_70: /bin/echo -e "RAMPR,1,179,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_80: /bin/echo -e "RAMPR,1,204,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_90: /bin/echo -e "RAMPR,1,230,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_100: /bin/echo -e "RAMPR,1,255,50\r" | netcat 192.168.0.49 4999 -w2
master_bedroom_lights_on_lnzr: /bin/echo -e "LNZR 1\r" | netcat 192.168.0.49 4999 -w2
###############################################################
# Master Bathroom - Room 0002 #
###############################################################
master_bathroom_lights_0: /bin/echo -e "RAMPR,2,0,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_10: /bin/echo -e "RAMPR,2,26,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_20: /bin/echo -e "RAMPR,2,51,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_30: /bin/echo -e "RAMPR,2,77,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_40: /bin/echo -e "RAMPR,2,102,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_50: /bin/echo -e "RAMPR,2,128,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_60: /bin/echo -e "RAMPR,2,153,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_70: /bin/echo -e "RAMPR,2,179,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_80: /bin/echo -e "RAMPR,2,204,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_90: /bin/echo -e "RAMPR,2,230,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_100: /bin/echo -e "RAMPR,2,255,50\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_lights_on_lnzr: /bin/echo -e "LNZR 2\r" | netcat 192.168.0.49 4999 -w2
master_bathroom_linen_closet_lights_10: /bin/echo -e "RAMPG,3885,26,50\r" | netcat 192.168.0.49 4999 -w2
###############################################################
# Hallway - Room 0003 #
###############################################################
hallway_lights_0: /bin/echo -e "RAMPR,3,0,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_10: /bin/echo -e "RAMPR,3,26,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_20: /bin/echo -e "RAMPR,3,51,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_30: /bin/echo -e "RAMPR,3,77,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_40: /bin/echo -e "RAMPR,3,102,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_50: /bin/echo -e "RAMPR,3,128,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_60: /bin/echo -e "RAMPR,3,153,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_70: /bin/echo -e "RAMPR,3,179,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_80: /bin/echo -e "RAMPR,3,204,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_90: /bin/echo -e "RAMPR,3,230,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_100: /bin/echo -e "RAMPR,3,255,50\r" | netcat 192.168.0.49 4999 -w2
hallway_lights_on_lnzr: /bin/echo -e "LNZR 3\r" | netcat 192.168.0.49 4999 -w2
###############################################################
# Living Room - Room 0004 #
###############################################################
living_room_lights_10: /bin/echo -e "RAMPR,4,26,50\r" | netcat 192.168.0.49 4999 -w2
living_room_lights_20: /bin/echo -e "RAMPR,4,51,50\r" | netcat 192.168.0.49 4999 -w2
living_room_lights_30: /bin/echo -e "RAMPR,4,77,50\r" | netcat 192.168.0.49 4999 -w2
living_room_lights_40: /bin/echo -e "RAMPR,4,102,50\r" | netcat 192.168.0.49 4999 -w2
living_room_lights_50: /bin/echo -e "RAMPR,4,128,50\r" | netcat 192.168.0.49 4999 -w2
living_room_lights_60: /bin/echo -e "RAMPR,4,153,50\r" | netcat 192.168.0.49 4999 -w2
living_room_lights_70: /bin/echo -e "RAMPR,4,179,50\r" | netcat 192.168.0.49 4999 -w2
living_room_lights_80: /bin/echo -e "RAMPR,4,204,50\r" | netcat 192.168.0.49 4999 -w2
living_room_lights_90: /bin/echo -e "RAMPR,4,230,50\r" | netcat 192.168.0.49 4999 -w2
living_room_lights_100: /bin/echo -e "RAMPR,4,255,50\r" | netcat 192.168.0.49 4999 -w2
living_room_lights_on_lnzr: /bin/echo -e "LNZR 4\r" | netcat 192.168.0.49 4999 -w2
###################################################################
# Sensors #
###################################################################
sensor:
###############################################################
# Master Bedroom - Group 3760 #
###############################################################
# Master Bedroom Recessed Load Level
- platform: command_line
command: >-
/bin/echo -e "STSG 3760\r" | netcat 192.168.0.49 4999 -w2
name: Master Bedroom Recessed Lights Level
#unit_of_measurement: "%"
scan_interval: 15
#value_template: '{{ value.split(", ")[2] | int / 2.55 | round(0)}}'
value_template: '{{ value.split(", ")[2] }}'
###############################################################
# Master Bathroom - Group 3884 #
###############################################################
# Master Bathroom Load Level
- platform: command_line
command: >-
/bin/echo -e "STSG 3884\r" | netcat 192.168.0.49 4999 -w2
name: Master Bathroom Lights Level
#unit_of_measurement: "%"
scan_interval: 30
#value_template: '{{ value.split(", ")[2] | int / 2.55 | round(0)}}'
value_template: '{{ value.split(", ")[2] }}'
###############################################################
# Hallway - Group 3536 #
###############################################################
# Hallway Load Level
- platform: command_line
command: >-
/bin/echo -e "STSG 3536\r" | netcat 192.168.0.49 4999 -w2
name: Hallway Lights Level
#unit_of_measurement: "%"
scan_interval: 45
#value_template: '{{ value.split(", ")[2] | int / 2.55 | round(0)}}'
value_template: '{{ value.split(", ")[2] }}'
###############################################################
# Living Room - Group 3600 #
###############################################################
# Living Room Load Level
- platform: command_line
command: >-
/bin/echo -e "STSG 3600\r" | netcat 192.168.0.49 4999 -w2
name: Living Room Lights Level
#unit_of_measurement: "%"
scan_interval: 60
#value_template: '{{ value.split(", ")[2] | int / 2.55 | round(0)}}'
value_template: '{{ value.split(", ")[2] }}'
###################################################################
# Load Levels Template #
###################################################################
# Format Incoming Values
###################################################################
# Input Numbers #
###################################################################
input_number:
###############################################################
# Master Bedroom - Group 3760 #
###############################################################
# Living Room Load Level
master_bedroom_recessed_lights_level:
min: 0
max: 255
name: Master Bedroom Recessed Lights Level
initial: 128
step: 1
mode: slider
icon: mdi:lightbulb-on-outline
###############################################################
# Master Bathroom - Group 3884 #
###############################################################
# Living Room Load Level
master_bathroom_lights_level:
min: 0
max: 255
name: Master Bathroom Lights Level
initial: 128
step: 1
mode: slider
icon: mdi:lightbulb-on-outline
###############################################################
# Hallway - Group 3536 #
###############################################################
hallway_lights_level:
min: 0
max: 255
name: Hallway Lights Level
initial: 128
step: 1
mode: slider
icon: mdi:lightbulb-on-outline
###############################################################
# Living Room - Group 3600 #
###############################################################
living_room_lights_level:
min: 0
max: 255
name: Living Room Lights Level
initial: 128
step: 1
mode: slider
icon: mdi:lightbulb-on-outline
###################################################################
# Light #
###################################################################
#light:
###############################################################
# Light Template - Master Bedroom #
###############################################################
# - platform: template
# lights:
# master_bedroom_recessed:
# friendly_name: "Master Bedroom Recessed Lights"
# level_template: "{{ states.input_number.master_bedroom_recessed_lights_level }}"
# value_template: "{{ sensor.theater_brightness.attributes.lux|int > 0 }}"
# turn_on:
# service: shell_command.master_bedroom_lights_on_lnzr
# turn_off:
# service: shell_command.master_bedroom_lights_0
# set_level:
# service: script.theater_lights_level
# data_template:
# brightness: "{{ brightness }}"
###################################################################
# Switch #
###################################################################
# switch:
# ###############################################################
# # Panic Mode - House Preset 14 #
# ###############################################################
# - platform: command_line
# switches:
# lights_panic_mode:
# command_on: /bin/echo -e "PANIC 1\r" | netcat 192.168.0.49 4999 -w2
# command_off: /bin/echo -e "PANIC 0\r" | netcat 192.168.0.49 4999 -w2
# #name: Panic Mode
###################################################################
# Automations #
###################################################################
automation:
###############################################################
# Master Bathroom - Day (Sunrise to Sunset) #
###############################################################
# Turn on lights in Master Bathroom if motion detected - Daytime
- alias: Master Bathroom Lights On Motion Daytime
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_6_181
to: 'on'
condition:
condition: and
conditions:
- condition: sun
after: sunrise
- condition: sun
before: sunset
#after_offset: "-1:00:00"
action:
- service: shell_command.master_bathroom_lights_100
- service: light.turn_on
data:
entity_id: group.lights_master_bathroom
brightness_pct: '100'
# 10 mins no motion - Turn off lights in Master Bathroom - Day
- alias: Master Bathroom Lights Off No Motion Day
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_6_181
to: 'off'
for:
minutes: 15
condition:
condition: and
conditions:
- condition: sun
after: sunrise
- condition: sun
before: sunset
action:
- service: shell_command.master_bathroom_lights_0
- service: light.turn_off
entity_id: group.lights_master_bathroom
###############################################################
# Master Bathroom - Night (Sunset to 9 PM) #
###############################################################
# Turn on lights in Master Bathroom if motion detected - Night
- alias: Master Bathroom Lights On Motion Night
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_6_181
to: 'on'
condition:
condition: and
conditions:
- condition: time
before: '21:00:00'
- condition: sun
after: sunset
action:
- service: shell_command.master_bathroom_lights_70
- service: light.turn_on
data:
entity_id: group.lights_master_bathroom
brightness_pct: '70'
# 10 mins no motion - Turn off lights in Master Bathroom - Night
- alias: Master Bathroom Lights Off No Motion Night
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_6_181
to: 'off'
for:
minutes: 15
condition:
condition: and
conditions:
- condition: time
before: '21:00:00'
- condition: sun
after: sunset
action:
- service: shell_command.master_bathroom_lights_0
# - service: light.turn_off
# entity_id: group.lights_master_bathroom
###############################################################
# Master Bathroom - Late (9 PM to Sunrise) #
###############################################################
# Turn on lights in Master Bathroom if motion detected - Late
- alias: Master Bathroom Lights On Motion Late
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_6_181
to: 'on'
condition:
condition: and
conditions:
- condition: sun
before: sunrise
- condition: time
after: '21:00:00'
action:
- service: shell_command.master_bathroom_linen_closet_lights_10
# - service: light.turn_on
# entity_id: light.shower_180
# data:
# brightness_pct: '10'
# - service: light.turn_on
# entity_id: light.linen_closet_177
# data:
# brightness_pct: '10'
# Turn off lights in Master Bathroom if motion not detected after 5 minutes
# Late
- alias: Master Bathroom Lights Off No Motion Late
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_6_181
to: 'off'
for:
minutes: 5
condition:
condition: and
conditions:
- condition: time
after: '21:00:00'
- condition: sun
before: sunrise
action:
- service: shell_command.master_bathroom_lights_0
# - service: light.turn_off
# entity_id: group.lights_master_bathroom
###############################################################
# Master Bedroom - Day (Sunrise to Sunset) #
###############################################################
# Turn on lights in Master Bedroom if motion detected - Daytime
- alias: Master Bedroom Lights On Motion Day
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_3_116
to: 'on'
condition:
condition: and
conditions:
- condition: sun
after: sunrise
after_offset: "+2:00:00"
- condition: sun
before: sunset
#after_offset: "-1:00:00"
action:
- service: shell_command.master_bedroom_lights_100
- service: light.turn_on
data:
entity_id: group.lights_master_bedroom
brightness_pct: '100'
# Turn off lights 20 mins no motion
- alias: Master Bedroom Lights Off No Motion Day
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_3_116
to: 'off'
for:
minutes: 20
condition:
condition: and
conditions:
- condition: sun
after: sunrise
after_offset: "+2:00:00"
- condition: sun
before: sunset
action:
- service: shell_command.master_bedroom_lights_0
# - service: light.turn_off
# entity_id: group.lights_master_bedroom
###############################################################
# Master Bedroom - Night (Sunset to 9 PM) #
###############################################################
# Turn on lights in Master Bedroom if motion detected - Night
- alias: Master Bedroom Lights On Motion Night
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_3_116
to: 'on'
condition:
condition: and
conditions:
- condition: time
before: '21:00:00'
- condition: sun
after: sunset
action:
- service: shell_command.master_bedroom_lights_60
# - service: light.turn_on
# data:
# entity_id: group.lights_master_bedroom
# brightness_pct: '60'
# Turn off lights in Master Bedroom if motion not detected after 30 minutes - Day/Night
- alias: Master Bedroom Lights Off No Motion Night
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_3_116
to: 'off'
for:
minutes: 30
condition:
condition: and
conditions:
- condition: time
before: '21:00:00'
- condition: sun
after: sunset
action:
- service: shell_command.master_bedroom_lights_0
- service: light.turn_off
entity_id: group.lights_master_bedroom
###############################################################
# Hallway - Day (Sunrise to Sunset) #
###############################################################
# Turn on lights in Hallway if motion detected - Day
- alias: Hallway Lights On Motion Day
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_5_188
to: 'on'
condition:
condition: and
conditions:
- condition: sun
after: sunrise
after_offset: "+1:00:00"
- condition: sun
before: sunset
#after_offset: "-1:00:00"
action:
- service: shell_command.hallway_lights_100
# - service: light.turn_on
# data:
# entity_id: group.lights_hallway
# brightness_pct: '100'
# Turn off lights in Hallway if motion not detected after 10 minutes - Day
- alias: Hallway Lights Off No Motion Day
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_5_188
to: 'off'
for:
minutes: 10
condition:
condition: and
conditions:
- condition: sun
after: sunrise
after_offset: "+1:00:00"
- condition: sun
before: sunset
#after_offset: "-1:00:00"
action:
- service: shell_command.hallway_lights_0
# - service: light.turn_off
# entity_id: group.lights_hallway
###############################################################
# Hallway - Night (Sunset to 9 PM) #
###############################################################
# Turn on lights in Hallway if motion detected - Night
- alias: Hallway Lights On Motion Night
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_5_188
to: 'on'
condition:
condition: and
conditions:
- condition: time
before: '21:00:00'
- condition: sun
after: sunset
action:
- service: shell_command.hallway_lights_60
# - service: light.turn_on
# data:
# entity_id: group.lights_hallway
# brightness_pct: '60'
# Turn off lights in Hallway if motion not detected after 10 minutes - Night
- alias: Hallway Lights Off No Motion Night
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_5_188
to: 'off'
for:
minutes: 10
condition:
condition: and
conditions:
- condition: time
before: '21:00:00'
- condition: sun
after: sunset
action:
- service: shell_command.hallway_lights_0
# - service: light.turn_off
# entity_id: group.lights_hallway
###############################################################
# Hallway - Late (9 PM to Sunrise) #
###############################################################
# Turn on lights in Hallway if motion detected - Late
- alias: Hallway Lights On Motion Late
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_5_188
to: 'on'
condition:
condition: and
conditions:
- condition: time
after: '21:00:00'
- condition: sun
before: sunrise
action:
- service: shell_command.hallway_lights_10
# - service: light.turn_on
# entity_id: group.lights_hallway
# data:
# brightness_pct: '10'
# Turn off lights in Hallway if motion not detected after 5 minutes
# Late
- alias: Hallway Lights Off No Motion Late
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_5_188
to: 'off'
for:
minutes: 5
condition:
condition: and
conditions:
- condition: time
after: '21:00:00'
- condition: sun
before: sunrise
action:
- service: shell_command.hallway_lights_0
# - service: light.turn_off
# entity_id: group.lights_hallway