mqtt: sensor: - state_topic: "viewroad-status/rpis/cctvquad1/cpu-temp" name: "CCTVQuad1 CPU Temperature" unit_of_measurement: "°C" icon: mdi:thermometer - state_topic: "viewroad-status/rpis/cctvquad1/cpu-use" name: "CCTVQuad1 CPU Use" unit_of_measurement: "%" icon: mdi:cpu-32-bit - state_topic: "viewroad-status/rpis/cctvquad1/ram-use" name: "CCTVQuad1 RAM Use" unit_of_measurement: "%" icon: mdi:raspberry-pi - state_topic: "viewroad-status/rpis/cctvquad1/disk-use" name: "CCTVQuad1 Disk Use" unit_of_measurement: "%" icon: mdi:harddisk - state_topic: "viewroad-status/rpis/cctvquad1/uptime" name: "CCTVQuad1 Uptime" icon: mdi:timer - state_topic: "viewroad-status/rpis/cctvquad1/last-seen" name: "CCTVQuad1 Last Seen" icon: mdi:calendar-clock - state_topic: "viewroad-status/rpis/cctvquad1/ipv4-address" name: "CCTVQuad1 IPv4 Address" icon: mdi:server-network - state_topic: "viewroad-status/rpis/cctvquad2/cpu-temp" name: "CCTVQuad2 CPU Temperature" unit_of_measurement: "°C" icon: mdi:thermometer - state_topic: "viewroad-status/rpis/cctvquad2/cpu-use" name: "CCTVQuad2 CPU Use" unit_of_measurement: "%" icon: mdi:cpu-32-bit - state_topic: "viewroad-status/rpis/cctvquad2/ram-use" name: "CCTVQuad2 RAM Use" unit_of_measurement: "%" icon: mdi:raspberry-pi - state_topic: "viewroad-status/rpis/cctvquad2/disk-use" name: "CCTVQuad2 Disk Use" unit_of_measurement: "%" icon: mdi:harddisk - state_topic: "viewroad-status/rpis/cctvquad2/uptime" name: "CCTVQuad2 Uptime" icon: mdi:timer - state_topic: "viewroad-status/rpis/cctvquad2/last-seen" name: "CCTVQuad2 Last Seen" icon: mdi:calendar-clock - state_topic: "viewroad-status/rpis/cctvquad2/ipv4-address" name: "CCTVQuad2 IPv4 Address" icon: mdi:server-network switch: - name: "CCTVQuad1 Reboot" state_topic: "viewroad-status/rpis/cctvquad1/reboot" command_topic: "viewroad-commands/rpis/cctvquad1/reboot/set" qos: 1 optimistic: false retain: false icon: mdi:refresh - name: "CCTVQuad1 Shutdown" state_topic: "viewroad-status/rpis/cctvquad1/shutdown" command_topic: "viewroad-commands/rpis/cctvquad1/shutdown/set" qos: 1 optimistic: false retain: false icon: mdi:close-network - name: "CCTVQuad2 Reboot" state_topic: "viewroad-status/rpis/cctvquad2/reboot" command_topic: "viewroad-commands/rpis/cctvquad2/reboot/set" qos: 1 optimistic: false retain: false icon: mdi:refresh - name: "CCTVQuad2 Shutdown" state_topic: "viewroad-status/rpis/cctvquad2/shutdown" command_topic: "viewroad-commands/rpis/cctvquad2/shutdown/set" qos: 1 optimistic: false retain: false icon: mdi:close-network binary_sensor: - platform: template sensors: pi_cctvquad1_on: friendly_name: "CCTV Quad1 Available" value_template: >- {%- if states( 'sensor.cctvquad1_last_seen' ) != 'unknown' and ( as_timestamp( now() ) - as_timestamp( states( 'sensor.cctvquad1_last_seen' ) ) ) <= 180 -%} True {%- else -%} False {%- endif %} - platform: template sensors: pi_cctvquad2_on: friendly_name: "CCTV Quad2 Available" value_template: >- {%- if states( 'sensor.cctvquad2_last_seen' ) != 'unknown' and ( as_timestamp( now() ) - as_timestamp( states( 'sensor.cctvquad2_last_seen' ) ) ) <= 180 -%} True {%- else -%} False {%- endif %} group: pi_cctvquad1_on: name: "RPi CCTV Quad1" #control: hidden entities: - sensor.cctvquad1_ipv4_address - sensor.cctvquad1_uptime - switch.cctvquad1_reboot - switch.cctvquad1_shutdown - sensor.cctvquad1_cpu_temperature - sensor.cctvquad1_cpu_use - sensor.cctvquad1_ram_use - sensor.cctvquad1_disk_use - sensor.cctvquad1_last_seen pi_cctvquad2_on: name: "RPi CCTV Quad2" #control: hidden entities: - sensor.cctvquad2_ipv4_address - sensor.cctvquad2_uptime - switch.cctvquad2_reboot - switch.cctvquad2_shutdown - sensor.cctvquad2_cpu_temperature - sensor.cctvquad2_cpu_use - sensor.cctvquad2_ram_use - sensor.cctvquad2_disk_use - sensor.cctvquad2_last_seen #automation: # - alias: "Home Assistant Start" # trigger: # platform: homeassistant # event: start # action: # - service: group.set_visibility # entity_id: # - group.pi_cctvquad1_on # data: # visible: False # - alias: "pi is on" # trigger: # platform: state # entity_id: # - binary_sensor.pi_cctvquad1_on # from: "off" # to: "on" # action: # - service: group.set_visibility # data_template: # entity_id: "group.pi_{{ trigger.entity_id | replace( 'binary_sensor.pi_', '' ) }}" # visible: True # - service: group.set_visibility # data_template: # entity_id: "group.pi_{{ trigger.entity_id | replace( 'binary_sensor.pi_', '' ) | replace( '_on', '' ) }}_off" # visible: False # - alias: "pi not seen" # trigger: # platform: state # entity_id: # - binary_sensor.pi_cctvquad1_on # from: "on" # to: "off" # action: # - service: group.set_visibility # data_template: # entity_id: "group.pi_{{ trigger.entity_id | replace( 'binary_sensor.pi_', '' ) | replace( '_on', '' ) }}_on" # visible: False # - service: group.set_visibility # data_template: # entity_id: "group.pi_{{ trigger.entity_id | replace( 'binary_sensor.pi_', '' ) | replace( '_on', '' ) }}_off" # visible: True #- service: notify.ios_PHONENAME #data_template: #title: "Pi Offline" #message: "{{ trigger.entity_id | replace( 'binary_sensor.pi_', '' ) | replace( '_on', '' ) }}" #- alias: 'pi disk use' #trigger: #platform: numeric_state #entity_id: #- sensor.cctvquad1_disk_use #above: 90 #action: #- service: notify.ios_PHONENAME #data_template: #title: "Pi Disk Use > 90%" #message: "{{ trigger.entity_id | replace( 'sensor.', '' ) | replace( '_disk_use', '' ) }}"