esphome pelmet LEDs, lounge scenes and other fixes

This commit is contained in:
root
2025-10-12 19:54:03 +13:00
parent e96344e3ad
commit bcf514a041
19 changed files with 951 additions and 1542 deletions
+91 -69
View File
@@ -74,107 +74,120 @@ script:
#####################################################################
scene_settings:
Bright:
light.esp_lounge6chdimmer_couch_spots_left: 00
light.esp_lounge6chdimmer_couch_spots_right: 00
light.esp_lounge6chdimmer_couch_spots_left: 0
light.esp_lounge6chdimmer_couch_spots_right: 0
#light.esp_lounge6chdimmer_dining_table_light: 100
light.esp_lounge6chdimmer_lounge_downlights_centre: 100 # Centre Downlights (x6, dimmable)
light.esp_lounge6chdimmer_lounge_downlights_south: 100 # South Downlights (x4, dimmable)
light.esp_lounge6chdimmer_lounge_rafter_buttons: 100 # Buttons in Rafters (x3, dimmable)
switch.esp_loungemiddleswitch_relay_3_downlights_north: "on" # North Downlights (x2 over stairs, non dimmable)
light.esp_lounge6chdimmer_lounge_downlights_centre: 100
light.esp_lounge6chdimmer_lounge_downlights_south: 100
light.esp_lounge6chdimmer_lounge_rafter_buttons: 100
switch.esp_loungemiddleswitch_relay_3_downlights_north: "on"
light.esp_breakfastbarleds_breakfast_bar_leds: 90
light.esp_loungecabinetleds2_lounge_cabinet_leds: 90
light.esp_loungebookshelfleds_lounge_bookshelf_leds: 90
light.tasmo_h801_loungeled1_6180_a: 90
light.tasmo_h801_loungeled1_6180_b: 90
switch.lounge_cupboard_dual_usb_xus09_l2: on
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: on # Back wall wallwasher Left
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: on # Back wall wallwasher right
switch.tasmo_ks811t_0702_lounge_3c: on # North Downlights (x2 over stairs, non dimmable)
switch.esp_loungenorthswitch_relay_1_main_lights: on # Single switch to hallway relay output (Pelmet LEDs)
switch.lounge_cupboard_dual_usb_xus09_l2: "on"
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: "on"
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: "on"
switch.tasmo_ks811t_0702_lounge_3c: "on"
#switch.esp_loungenorthswitch_relay_1_main_lights: "on"
number.esp_loungepelmetleds2_lounge_pelmet_leds_a_output_set_0_100: 100
number.esp_loungepelmetleds2_lounge_pelmet_leds_b_output_set_0_100: 100
TV General:
light.esp_lounge6chdimmer_couch_spots_left: 60
light.esp_lounge6chdimmer_couch_spots_right: 60
#light.esp_lounge6chdimmer_dining_table_light: 100
light.esp_lounge6chdimmer_lounge_downlights_centre: 60
light.esp_lounge6chdimmer_lounge_downlights_south: 60
light.esp_lounge6chdimmer_lounge_rafter_buttons: 40
light.esp_breakfastbarleds_breakfast_bar_leds: 60
light.esp_loungecabinetleds2_lounge_cabinet_leds: 60
light.esp_loungebookshelfleds_lounge_bookshelf_leds: 60
switch.esp_loungemiddleswitch_relay_3_downlights_north: "off" # non-dimmable pair
switch.lounge_cupboard_dual_usb_xus09_l2: "on"
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: "off"
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: "off"
#switch.esp_loungenorthswitch_relay_1_main_lights: "on"
number.esp_loungepelmetleds2_lounge_pelmet_leds_a_output_set_0_100: 60
number.esp_loungepelmetleds2_lounge_pelmet_leds_b_output_set_0_100: 60
Movie:
#light.esp_lounge6chdimmer_couch_spots_left: 40
#light.esp_lounge6chdimmer_couch_spots_right: 40
light.esp_lounge6chdimmer_couch_spots_left: 20
light.esp_lounge6chdimmer_couch_spots_right: 20
#light.esp_lounge6chdimmer_dining_table_light: 100
light.esp_lounge6chdimmer_lounge_downlights_centre: 20 # Centre Downlights (x6, dimmable)
light.esp_lounge6chdimmer_lounge_downlights_south: 20 # South Downlights (x4, dimmable)
light.esp_lounge6chdimmer_lounge_rafter_buttons: 20 # Buttons in Rafters (x3, dimmable)
light.esp_lounge6chdimmer_lounge_downlights_centre: 20
light.esp_lounge6chdimmer_lounge_downlights_south: 20
light.esp_lounge6chdimmer_lounge_rafter_buttons: 20
light.esp_breakfastbarleds_breakfast_bar_leds: 40
light.esp_loungecabinetleds2_lounge_cabinet_leds: 40
light.esp_loungebookshelfleds_lounge_bookshelf_leds: 40
light.tasmo_h801_loungeled1_6180_a: 60
light.tasmo_h801_loungeled1_6180_b: 60
switch.esp_loungemiddleswitch_relay_3_downlights_north: off # North Downlights (x2 over stairs, non dimmable) switch.lounge_cupboard_dual_usb_xus09_l2: "on"
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: off # Back wall wallwasher Left
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: off # Back wall wallwasher right
switch.esp_loungenorthswitch_relay_1_main_lights: on # Single switch to hallway relay output (Pelmet LEDs)
Night Light:
#light.esp_lounge6chdimmer_couch_spots_left: 40
#light.esp_lounge6chdimmer_couch_spots_right: 40
#light.esp_lounge6chdimmer_dining_table_light: 100
light.esp_lounge6chdimmer_lounge_downlights_centre: 5 # Centre Downlights (x6, dimmable)
#light.esp_lounge6chdimmer_lounge_downlights_south: 20 # South Downlights (x4, dimmable)
light.esp_lounge6chdimmer_lounge_rafter_buttons: 5 # Buttons in Rafters (x3, dimmable)
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: off # Back wall wallwasher Left
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: off # Back wall wallwasher right
switch.esp_loungemiddleswitch_relay_3_downlights_north: "off"
switch.lounge_cupboard_dual_usb_xus09_l2: "on"
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: "off"
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: "off"
#switch.esp_loungenorthswitch_relay_1_main_lights: "on"
number.esp_loungepelmetleds2_lounge_pelmet_leds_a_output_set_0_100: 40
number.esp_loungepelmetleds2_lounge_pelmet_leds_b_output_set_0_100: 40
Reading On/Off:
light.esp_lounge6chdimmer_couch_spots_left: toggle_75
light.esp_lounge6chdimmer_couch_spots_right: toggle_75
light.esp_lounge6chdimmer_couch_spots_left: "toggle_75"
light.esp_lounge6chdimmer_couch_spots_right: "toggle_75"
#light.esp_lounge6chdimmer_dining_table_light: 60
#light.esp_lounge6chdimmer_lounge_downlights_centre: 45
#light.esp_lounge6chdimmer_lounge_downlights_south: 35
#light.esp_lounge6chdimmer_lounge_rafter_buttons: 20
#switch.tasmo_ks811t_0702_lounge_3c: on
#switch.tasmo_ks811t_0702_lounge_3c: "on"
Night Light:
#light.esp_lounge6chdimmer_couch_spots_left: 20
#light.esp_lounge6chdimmer_couch_spots_right: 20
#light.esp_lounge6chdimmer_dining_table_light: 100
light.esp_lounge6chdimmer_lounge_downlights_centre: 0
light.esp_lounge6chdimmer_lounge_downlights_south: 0
light.esp_lounge6chdimmer_lounge_rafter_buttons: 0
light.esp_breakfastbarleds_breakfast_bar_leds: 5
light.esp_loungecabinetleds2_lounge_cabinet_leds: 5
light.esp_loungebookshelfleds_lounge_bookshelf_leds: 5
switch.esp_loungemiddleswitch_relay_3_downlights_north: "off"
switch.lounge_cupboard_dual_usb_xus09_l2: "off"
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: "off"
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: "off"
#switch.esp_loungenorthswitch_relay_1_main_lights: "on"
number.esp_loungepelmetleds2_lounge_pelmet_leds_a_output_set_0_100: 5
number.esp_loungepelmetleds2_lounge_pelmet_leds_b_output_set_0_100: 5
Warm Cozy:
light.esp_lounge6chdimmer_couch_spots_left: 30
light.esp_lounge6chdimmer_couch_spots_right: 30
light.esp_lounge6chdimmer_couch_spots_left: 20
light.esp_lounge6chdimmer_couch_spots_right: 20
light.esp_lounge6chdimmer_lounge_rafter_buttons: 15
light.esp_breakfastbarleds_breakfast_bar_leds: 25
light.esp_loungecabinetleds2_lounge_cabinet_leds: 30
light.esp_loungebookshelfleds_lounge_bookshelf_leds: 30
light.tasmo_h801_loungeled1_6180_a: 25
light.tasmo_h801_loungeled1_6180_b: 25
switch.lounge_cupboard_dual_usb_xus09_l2: on
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: on # Back wall wallwasher Left
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: on # Back wall wallwasher right
TV General:
light.esp_lounge6chdimmer_couch_spots_left: 50
light.esp_lounge6chdimmer_couch_spots_right: 50
#light.esp_lounge6chdimmer_dining_table_light: 100
light.esp_lounge6chdimmer_lounge_downlights_centre: 40 # Centre Downlights (x6, dimmable)
light.esp_lounge6chdimmer_lounge_downlights_south: 40 # South Downlights (x4, dimmable)
light.esp_lounge6chdimmer_lounge_rafter_buttons: 40 # Buttons in Rafters (x3, dimmable)
light.esp_breakfastbarleds_breakfast_bar_leds: 60
light.esp_loungecabinetleds2_lounge_cabinet_leds: 60
light.esp_loungebookshelfleds_lounge_bookshelf_leds: 60
light.tasmo_h801_loungeled1_6180_a: 60
light.tasmo_h801_loungeled1_6180_b: 60
switch.esp_loungemiddleswitch_relay_3_downlights_north: off # North Downlights (x2 over stairs, non dimmable) switch.lounge_cupboard_dual_usb_xus09_l2: "on"
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: off # Back wall wallwasher Left
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: off # Back wall wallwasher right
switch.esp_loungenorthswitch_relay_1_main_lights: on # Single switch to hallway relay output (Pelmet LEDs)
switch.lounge_cupboard_dual_usb_xus09_l2: "on"
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: "on"
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: "on"
#switch.esp_loungenorthswitch_relay_1_main_lights: "on"
number.esp_loungepelmetleds2_lounge_pelmet_leds_a_output_set_0_100: 20
number.esp_loungepelmetleds2_lounge_pelmet_leds_b_output_set_0_100: 20
All Off:
light.esp_lounge6chdimmer_couch_spots_left: 0
light.esp_lounge6chdimmer_couch_spots_right: 0
light.esp_lounge6chdimmer_dining_table_light: 0
light.esp_lounge6chdimmer_lounge_downlights_centre: 0 # Centre Downlights (x6, dimmable)
light.esp_lounge6chdimmer_lounge_downlights_south: 0 # South Downlights (x4, dimmable)
light.esp_lounge6chdimmer_lounge_rafter_buttons: 0 # Buttons in Rafters (x3, dimmable)
switch.esp_loungemiddleswitch_relay_3_downlights_north: "off" # North Downlights (x2 over stairs, non dimmable)
light.esp_lounge6chdimmer_lounge_downlights_centre: 0
light.esp_lounge6chdimmer_lounge_downlights_south: 0
light.esp_lounge6chdimmer_lounge_rafter_buttons: 0
switch.esp_loungemiddleswitch_relay_3_downlights_north: "off"
light.esp_breakfastbarleds_breakfast_bar_leds: 0
light.esp_loungecabinetleds2_lounge_cabinet_leds: 0
light.esp_loungebookshelfleds_lounge_bookshelf_leds: 0
light.tasmo_h801_loungeled1_6180_a: 0
light.tasmo_h801_loungeled1_6180_b: 0
switch.lounge_cupboard_dual_usb_xus09_l2: off
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: off # Back wall wallwasher Left
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: off # Back wall wallwasher right
switch.esp_loungenorthswitch_relay_1_main_lights: off # Single switch to hallway relay output (Pelmet LEDs)
switch.lounge_cupboard_dual_usb_xus09_l2: "off"
switch.esp_loungesouthleftswitch_relay_1_wall_washer_left: "off"
switch.esp_loungesouthrightswitch_relay_2_wall_washer_right: "off"
#switch.esp_loungenorthswitch_relay_1_main_lights: "on"
number.esp_loungepelmetleds2_lounge_pelmet_leds_a_output_set_0_100: 0
number.esp_loungepelmetleds2_lounge_pelmet_leds_b_output_set_0_100: 0
#####################################################################
#####################################################################
@@ -202,8 +215,17 @@ script:
is_toggle: "{{ (not is_num) and (vstr|lower).startswith('toggle') }}"
toggle_pct: "{{ (vstr.split('_')|last)|int if ('_' in vstr) else 100 }}"
currently_on: "{{ is_state(ent, 'on') }}"
is_number_ent: "{{ ent.startswith('number.') }}" # 🔹 NEW
- choose:
# 0) Numbers: set numeric value (e.g. 0..100)
- conditions: "{{ is_number_ent and is_num }}" # 🔹 NEW
sequence:
- service: number.set_value
data:
entity_id: "{{ ent }}"
value: "{{ val|float }}"
# 1) Lights: toggle[_NN] -> if on turn off, else turn on to NN (default 100)
- conditions: "{{ is_light and is_toggle }}"
sequence:
-370
View File
@@ -1,370 +0,0 @@
rest:
scan_interval: 5
resource_template: "http://192.168.2.31:7125/server/files/metadata?filename={{ states(('sensor.3d_printer_current_print')) | urlencode }}"
sensor:
- name: printer_3d_file_metadata
unique_id: "192.168.2.315ec44d90-419c-419c-802d-d34071639c08"
json_attributes_path: "$.result"
json_attributes:
- layer_height
- object_height
- thumbnails
value_template: "OK"
#camera:
# Loading generic IP camera via configuration.yaml is deprecated, it will be automatically imported. Once you have confirmed correct operation, please remove 'generic' (IP camera) section(s) from configuration.yaml
# Directions in the README.md for how to add the Thumbnail now.
# - platform: generic
# name: "3D Printer Thumbnail"
# still_image_url: http://192.168.2.31:7125/server/files/gcodes/{{ states("sensor.3d_printer_object_thumbnails") }}
# verify_ssl: false
# This no longer works broken in current builds https://www.home-assistant.io/blog/2022/05/04/release-20225/#breaking-changes -> MJPEG IP Camera
# Directions in the README.md for how to add the MJPEG IP Camera now.
# - platform: mjpeg
# name: "3D Printer Camera"
# still_image_url: http://192.168.2.31/webcam/?action=snapshot
# mjpeg_url: http://192.168.2.31/webcam/?action=stream
# verify_ssl: false
rest_command:
3d_printer_emergency_stop:
url: "http://192.168.2.31:7125/printer/emergency_stop"
method: post
3d_printer_firmware_restart:
url: "http://192.168.2.31:7125/printer/firmware_restart"
method: post
3d_printer_cancel:
url: "http://192.168.2.31:7125/printer/print/cancel"
method: post
3d_printer_pause:
url: "http://192.168.2.31:7125/printer/print/pause"
method: post
3d_printer_resume:
url: "http://192.168.2.31:7125/printer/print/resume"
method: post
sensor:
- platform: rest
name: printer_3d_sensor
unique_id: "192.168.2.313a0c25fa-297d-4c19-b03c-ddf04840682b"
resource: "http://192.168.2.31:7125/printer/objects/query?heater_bed&extruder&print_stats&toolhead&display_status&virtual_sdcard&gcode_move&filament_motion_sensor%20btt_smart_filament&temperature_sensor%20Chamber_Temp"
json_attributes_path: "$.result.status"
json_attributes:
- heater_bed
- extruder
- print_stats
- toolhead
- display_status
- virtual_sdcard
- gcode_move
- "filament_motion_sensor btt_smart_filament_sensor"
- "temperature_sensor Chamber_Temp"
value_template: "OK"
force_update: true
scan_interval: 1
- platform: rest
name: printer_3d_info
unique_id: "192.168.2.311cba6677-02bd-4273-9083-b8301bf6943b"
scan_interval: 1
resource_template: "http://192.168.2.31:7125/printer/info"
json_attributes_path: "$.result"
json_attributes:
- state_message
- state
value_template: "OK"
- platform: rest
name: printer_3d_server
unique_id: "192.168.2.311cba6677-02bd-4273-9083-b8301bf6949"
scan_interval: 1
resource_template: "http://192.168.2.31:7125/server/database/item?namespace=mainsail&key=general"
json_attributes_path: "$.result.value"
json_attributes:
- printername
value_template: "OK"
template:
- binary_sensor:
- name: 3d_printer_filament
unique_id: "192.168.2.315ce32fc9-5e95-49e7-80e7-bfdd2cf1d1fd"
device_class: motion
state: '{{ states.sensor.printer_3d_sensor.attributes["filament_switch_sensor Filament"]["filament_detected"] }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:printer-3d-nozzle-alert
attributes:
friendly_name: "Filament Detected"
- sensor:
- name: 3d_printer_printername
unique_id: "192.168.2.313a0f3144-a801-422f-adb6-e2ed35796074"
state: '{{ states.sensor.printer_3d_server.attributes["printername"]}}'
availability: >
{% set items = ['sensor.printer_3d_server'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:printer-3d
attributes:
friendly_name: "Printer Name"
- name: 3d_printer_chamber_temp
unique_id: "192.168.2.31167e5dec-719c-42d3-9560-4f177573f741"
state: '{{ states.sensor.printer_3d_sensor.attributes["temperature_sensor Chamber_Temp"]["temperature"] | float(0) | round(1) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "°C"
icon: mdi:thermometer
attributes:
friendly_name: "Chamber Actual"
- name: 3d_printer_hotend_target
unique_id: "192.168.2.31167e5dec-719c-42d3-9560-4f177573f740"
state: '{{ states.sensor.printer_3d_sensor.attributes["extruder"]["target"] | float(0) | round(1) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "°C"
icon: mdi:thermometer
attributes:
friendly_name: "Hotend Target"
- name: 3d_printer_hotend_actual
unique_id: "192.168.2.317c2593fb-a7dd-4ed7-a865-2e4dddddbb40"
state: '{{ states.sensor.printer_3d_sensor.attributes["extruder"]["temperature"] | float(0) | round(1) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "°C"
icon: mdi:thermometer
attributes:
friendly_name: "Hotend Actual"
- name: 3d_printer_hotend_power
unique_id: "192.168.2.31c57a1e35-92fa-403e-b3cf-ec1e97ef94cf"
state: '{{ states.sensor.printer_3d_sensor.attributes["extruder"]["power"] | float(0) | round(3) * 100}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "%"
icon: mdi:flash
attributes:
friendly_name: "Hotend Power"
- name: 3d_printer_bed_target
unique_id: "192.168.2.31eadec415-c281-4814-8fba-17c6c42670ec"
state: '{{ states.sensor.printer_3d_sensor.attributes["heater_bed"]["target"] | float(0) | round(1) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "°C"
icon: mdi:thermometer
attributes:
friendly_name: "Bed Target"
- name: 3d_printer_bed_actual
unique_id: "192.168.2.31cb33503c-c5d4-4e06-b79b-c1cd64ca2d7a"
state: '{{ states.sensor.printer_3d_sensor.attributes["heater_bed"]["temperature"] | float(0) | round(1) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "°C"
icon: mdi:thermometer
attributes:
friendly_name: "Bed Actual"
- name: 3d_printer_bed_power
unique_id: "192.168.2.31abb2fc5b-8173-4131-a942-fb11e30f4efa"
state: '{{ states.sensor.printer_3d_sensor.attributes["heater_bed"]["power"] | float(0) | round(3) * 100 }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "%"
icon: mdi:flash
attributes:
friendly_name: "Bed Power"
- name: 3d_printer_state
unique_id: "192.168.2.31758ce84c-3210-4f29-b6b3-38139180de96"
state: '{{ states.sensor.printer_3d_sensor.attributes["print_stats"]["state"] }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: >
{% set val = states.sensor.printer_3d_sensor.attributes["print_stats"]["state"] %}
{% if val == 'standby' %}
mdi:sleep
{% elif val == 'error' %}
mdi:alert-circle
{% elif val == 'printing' %}
mdi:printer-3d-nozzle
{% elif val == 'paused' %}
mdi:pause-circle
{% elif val == 'complete' %}
mdi:printer-3d
{% else %}
mdi:help-circle
{% endif %}
attributes:
friendly_name: "Printer State"
- name: 3d_printer_current_print
unique_id: "192.168.2.313a0f3144-a801-422f-adb6-e2ed35796072"
state: '{{ states.sensor.printer_3d_sensor.attributes["print_stats"]["filename"]}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:file
attributes:
friendly_name: "Current Print"
- name: 3d_printer_current_progress
unique_id: "192.168.2.318ec7163b-be00-4a10-8051-48cf9a260a29"
state: '{{ ((states.sensor.printer_3d_sensor.attributes["display_status"]["progress"])*100) | round(0, "floor") }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "%"
icon: mdi:progress-clock
attributes:
friendly_name: "Progress"
- name: 3d_printer_print_time
unique_id: "192.168.2.31e1ac0fac-e8ba-4e05-8fa0-c8d8076f9f63"
state: '{{ states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"] |timestamp_custom("%H:%M:%S", 0)}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:camera-timer
attributes:
friendly_name: "Time Elapsed"
- name: 3d_printer_time_remaining
unique_id: "192.168.2.31e12c8def-5ebe-43a4-9f75-605a0c46fc0f"
state: '{{ (((states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"]/states.sensor.printer_3d_sensor.attributes["display_status"]["progress"]- states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"]) if states.sensor.printer_3d_sensor.attributes["display_status"]["progress"]>0 else 0)) | timestamp_custom("%H:%M:%S", 0)}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:timer-sand
attributes:
friendly_name: "Time Remaining"
- name: 3d_printer_eta
unique_id: "192.168.2.31a2b57068-9a32-4d2c-8cc9-57d2389a9082"
state: '{{ (as_timestamp(now())+((states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"]/states.sensor.printer_3d_sensor.attributes["display_status"]["progress"]- states.sensor.printer_3d_sensor.attributes["print_stats"]["print_duration"]) if states.sensor.printer_3d_sensor.attributes["display_status"]["progress"]>0 else 0)) | timestamp_custom("%H:%M:%S", 1)}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:av-timer
attributes:
friendly_name: "ETA"
- name: 3d_printer_message
unique_id: "192.168.2.310c418c0d-e59e-4d4e-aa11-8fae53df58f8"
state: '{{ states.sensor.printer_3d_sensor.attributes["display_status"]["message"]}}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:message-cog
attributes:
friendly_name: "Message"
- name: 3d_printer_layer_height
unique_id: "192.168.2.316cca455d-c327-4567-b886-4d7f99714265"
state: '{{ states.sensor.printer_3d_file_metadata.attributes["layer_height"] | float(0) }}'
availability: >
{% set items = ['sensor.printer_3d_file_metadata'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "mm"
icon: mdi:arrow-collapse-down
attributes:
friendly_name: "Layer Height"
- name: 3d_printer_object_height
unique_id: "192.168.2.316d6d9dc0-9a02-4ce4-a797-c84b42e011a6"
state: '{{ (states.sensor.printer_3d_file_metadata.attributes["object_height"] | float(0)) - (states.sensor.printer_3d_file_metadata.attributes["layer_height"] | float(0)) }}'
availability: >
{% set items = ['sensor.printer_3d_file_metadata'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "mm"
icon: mdi:arrow-expand-vertical
attributes:
friendly_name: "Object Height"
- name: 3d_printer_current_height
unique_id: "192.168.2.31d440e568-d4d1-4b3f-85c4-fdacd68c0e1a"
state: '{{ states.sensor.printer_3d_sensor.attributes["gcode_move"]["gcode_position"][2] | float(0) | round(2) }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
unit_of_measurement: "mm"
icon: mdi:arrow-collapse-down
attributes:
friendly_name: "Current Height"
- name: 3d_printer_current_layer
unique_id: "192.168.2.316a77acc1-8134-4354-b2f6-390adab81993"
state: '{{ (states("sensor.3d_printer_current_height")|float(0) / states("sensor.3d_printer_layer_height")|float(0))|round(0) }}'
availability: >
{% set items = ['sensor.3d_printer_current_height','sensor.3d_printer_layer_height'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:counter
attributes:
friendly_name: "Current Layer"
- name: 3d_printer_total_layers
unique_id: "192.168.2.3153cfe906-28ec-44cd-926a-b08ffb8766e5"
state: '{{ (states("sensor.3d_printer_object_height")|float(0) / states("sensor.3d_printer_layer_height")|float(0))|round(0) }}'
availability: >
{% set items = ['sensor.3d_printer_object_height','sensor.3d_printer_layer_height'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:counter
attributes:
friendly_name: "Total Layer"
- name: 3d_printer_actual_layer
unique_id: "192.168.2.31167e5dec-719c-42d3-9560-4f177573f742"
state: '{{ states.sensor.printer_3d_sensor.attributes.print_stats["info"]["current_layer"] }} / {{ states.sensor.printer_3d_sensor.attributes.print_stats["info"]["total_layer"] }}'
availability: >
{% set items = ['sensor.printer_3d_sensor'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:layers-triple
attributes:
friendly_name: "Actual Layer"
- name: 3d_printer_object_thumbnails
unique_id: "192.168.2.3159b37837-b751-4d31-98c2-516a52edf833"
state: >
{% set dir = states('sensor.3d_printer_current_print') %}
{% set thumb = state_attr('sensor.printer_3d_file_metadata','thumbnails') %}
{% set img = (thumb | last).relative_path if thumb else 'not available' %}
{{ (dir.split('/')[:-1] + [img]) | join('/') }}
availability: >
{% set items = ['sensor.printer_3d_file_metadata'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:image
attributes:
friendly_name: "Object Thumbnails"
- name: 3d_printer_state_message
unique_id: "192.168.2.319a5184c9-ac5b-44a9-a691-2b67c243d197"
state: '{{ states.sensor.printer_3d_info.attributes["state_message"] }}'
availability: >
{% set items = ['sensor.printer_3d_info'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:message-cog
attributes:
friendly_name: "State Message"
- name: 3d_printer_heaters_power
unique_id: "192.168.2.313988e9be-c910-4634-8205-38d53170d5a5"
state: '{{ states("sensor.3d_printer_bed_power")|float(0) | round(1) }}% / {{ states("sensor.3d_printer_hotend_power")|float(0) | round(1) }}%'
availability: >
{% set items = ['sensor.3d_printer_bed_power','sensor.3d_printer_hotend_power'] %}
{{ expand(items)|rejectattr('state','in',['unknown','unavailable'])
|list|count == items|count }}
icon: mdi:meter-electric-outline
attributes:
friendly_name: "Bed and Nozzle Power"
+131
View File
@@ -0,0 +1,131 @@
###############################################################################
# PACKAGE: OpenHASP Thermostat (MQTT-only, all BUTTON objects)
# NODE/TOPIC ROOT: hasp/openhasp_1/
###############################################################################
input_number:
lounge_setpoint:
name: Lounge Setpoint
min: 10
max: 30
step: 0.5
mode: box
unit_of_measurement: "C"
###############################################################################
# AUTOMATIONS
###############################################################################
automation:
# --- PUSH LABEL TEXTS (on buttons) ----------------------------------------
- id: hasp_temp_to_btn_text
alias: "HASP: update temp (p1b1.text)"
mode: queued
trigger:
- platform: state
entity_id: sensor.lounge_inside_temperature
action:
- service: mqtt.publish
data:
topic: "hasp/openhasp_1/command/p1b1.text"
payload: "{{ states('sensor.lounge_inside_temperature')|float(0)|round(1) }} C"
- id: hasp_setpoint_to_btn_text
alias: "HASP: update setpoint (p1b2.text)"
mode: queued
trigger:
- platform: state
entity_id: input_number.lounge_setpoint
action:
- service: mqtt.publish
data:
topic: "hasp/openhasp_1/command/p1b2.text"
payload: "Set: {{ states('input_number.lounge_setpoint')|float(0)|round(1) }} C"
- id: hasp_heater_status_to_btn_text
alias: "HASP: update heater status (p1b5.text)"
mode: queued
trigger:
- platform: state
entity_id: switch.lounge_heater
action:
- service: mqtt.publish
data:
topic: "hasp/openhasp_1/command/p1b5.text"
payload: >
{% if is_state('sensor.gas_heater_operating','ON') %}
HEAT ON
{% else %}
HEAT OFF
{% endif %}
# --- BUTTON HANDLING FROM THE PLATE (listens on /state/) ------------------
- id: hasp_btn_up_increment
alias: "HASP: p1b3 up -> increment setpoint"
mode: queued
trigger:
- platform: mqtt
topic: "hasp/openhasp_1/state/p1b4"
condition:
- condition: template
value_template: "{{ trigger.payload_json.event|default('') == 'up' }}"
action:
- service: input_number.increment
target:
entity_id: input_number.lounge_setpoint
- id: hasp_btn_down_decrement
alias: "HASP: p1b4 up -> decrement setpoint"
mode: queued
trigger:
- platform: mqtt
topic: "hasp/openhasp_1/state/p1b3"
condition:
- condition: template
value_template: "{{ trigger.payload_json.event|default('') == 'up' }}"
action:
- service: input_number.decrement
target:
entity_id: input_number.lounge_setpoint
# --- PUSH INITIAL VALUES ON HA START / PANEL ONLINE -----------------------
- id: hasp_push_on_ha_start
alias: "HASP: push texts on HA start"
trigger:
- platform: homeassistant
event: start
action:
- service: script.hasp_push_all_texts
- id: hasp_push_on_plate_birth
alias: "HASP: push texts on panel birth"
trigger:
- platform: mqtt
topic: "hasp/openhasp_1/state"
action:
- service: script.hasp_push_all_texts
###############################################################################
# SCRIPT: Push all texts to buttons
###############################################################################
script:
hasp_push_all_texts:
alias: "HASP: push all texts"
mode: queued
sequence:
- service: mqtt.publish
data:
topic: "hasp/openhasp_1/command/p1b1.text"
payload: "{{ states('sensor.lounge_inside_temperature')|float(0)|round(1) }} C"
- service: mqtt.publish
data:
topic: "hasp/openhasp_1/command/p1b2.text"
payload: "Set: {{ states('input_number.lounge_setpoint')|float(0)|round(1) }} C"
- service: mqtt.publish
data:
topic: "hasp/openhasp_1/command/p1b5.text"
payload: >
{% if is_state('sensor.gas_heater_operating','ON') %}
HEAT ON
{% else %}
HEAT OFF
{% endif %}