diff --git a/automations.yaml b/automations.yaml index 5dfe4c05..dfed2c75 100644 --- a/automations.yaml +++ b/automations.yaml @@ -3541,8 +3541,9 @@ - id: '1787462157568' alias: 3D Print Early Layers Snapshot description: Telegram-only snapshots from all 3 printer cameras. Fires when Z crosses - 1.0 mm, then again at 25%, 50% and 75% print progress. Re-asserts the SparkX i7 - light and bedroom lamp before capturing so the photos are lit. + 1.0 mm, then again at 25%, 50% and 75% print progress. Lights the SparkX i7 and + bedroom lamp only if they are currently off, then restores whatever state they + were in before capturing. triggers: - above: 1 entity_id: sensor.sparkx_i7_position_z @@ -3562,6 +3563,7 @@ state: printing actions: - variables: + bedroom_needs_light: '{{ not is_state(''light.bedroom_lamp_2'', ''on'') }}' message: '{% set file = state_attr(''sensor.sparkx_i7_print_status'', ''file'') or '''' %} {% set name = ''Print'' if file in ['''', none, ''unknown'', ''unavailable''] else file.split(''/'')[-1].replace(''.gcode'', '''') %} {% set pct = states(''sensor.sparkx_i7_print_progress'') @@ -3572,19 +3574,25 @@ layers (Z {{ trigger.to_state.state | float(1) }} mm) {% elif trigger.to_state.state | float(0) >= 75 %} 75% complete {% elif trigger.to_state.state | float(0) >= 50 %} 50% complete {% else %} 25% complete {% endif %}' + sparkx_needs_light: '{{ not is_state(''light.sparkx_i7_light'', ''on'') }}' tag: '{% if trigger.entity_id == ''sensor.sparkx_i7_position_z'' %} z1 {% else %} p{{ trigger.above | int }} {% endif %}' - if: - condition: template - value_template: '{{ not is_state(''light.sparkx_i7_light'', ''on'') or not is_state(''light.bedroom_lamp_2'', - ''on'') }}' + value_template: '{{ sparkx_needs_light }}' then: - action: light.turn_on continue_on_error: true target: - entity_id: - - light.sparkx_i7_light - - light.bedroom_lamp_2 + entity_id: light.sparkx_i7_light + - if: + - condition: template + value_template: '{{ bedroom_needs_light }}' + then: + - action: light.turn_on + continue_on_error: true + target: + entity_id: light.bedroom_lamp_2 - delay: seconds: 3 - parallel: @@ -3603,6 +3611,24 @@ filename: /config/www/ender_cam2_{{ tag }}.jpg target: entity_id: camera.endercamera2_duckdns_org + - delay: + seconds: 2 + - if: + - condition: template + value_template: '{{ sparkx_needs_light }}' + then: + - action: light.turn_off + continue_on_error: true + target: + entity_id: light.sparkx_i7_light + - if: + - condition: template + value_template: '{{ bedroom_needs_light }}' + then: + - action: light.turn_off + continue_on_error: true + target: + entity_id: light.bedroom_lamp_2 - action: telegram_bot.send_media_group data: caption: '{{ message }}' diff --git a/zigbee2mqtt/state.json b/zigbee2mqtt/state.json index 3d632785..d2a8b24e 100644 --- a/zigbee2mqtt/state.json +++ b/zigbee2mqtt/state.json @@ -27,7 +27,7 @@ "led_brightness": 100, "countdown_to_turn_off": 0, "countdown_to_turn_on": 0, - "power": 2, + "power": 1.9, "current": 0.09, "energy": 50.9, "power_factor": 0.17, @@ -45,9 +45,9 @@ "state": "ON", "led_brightness": 100, "countdown_to_turn_off": 0, - "voltage": 119.8, + "voltage": 119.3, "countdown_to_turn_on": 0, - "energy": 96.41, + "energy": 96.42, "power_factor": 0.88, "ac_frequency": 60, "update": { @@ -58,7 +58,7 @@ "latest_release_notes": null }, "linkquality": 145, - "power": 85.4, + "power": 85.2, "current": 0.85, "power_on_behavior": "on" }, @@ -78,9 +78,9 @@ "state": "ON", "ac_frequency": 60, "energy": 198.9, - "power": 95.2, - "current": 0.85, - "power_factor": 0.94, + "power": 0.8, + "current": 0.05, + "power_factor": 0.39, "update": { "state": "idle", "installed_version": 268513381, @@ -95,11 +95,11 @@ "led_brightness": 100, "countdown_to_turn_off": 0, "countdown_to_turn_on": 0, - "voltage": 120.1, + "voltage": 119.6, "energy": 96.08, "state": "ON", - "power": 10.7, - "current": 0.18, + "power": 16.5, + "current": 0.26, "ac_frequency": 60, "power_factor": 0.58, "update": { @@ -119,7 +119,7 @@ "energy": 13.31, "current": 0.01, "power": 0.1, - "power_factor": 0.2, + "power_factor": 0.11, "linkquality": 116, "update": { "state": "idle", @@ -142,7 +142,7 @@ "state": "ON", "current": 0.02, "ac_frequency": 60, - "power": 0.4, + "power": 0.3, "power_factor": 0.14, "update": { "state": "idle",