فهرست منبع

Multiple changes. Kitchen dim. Stove. Morning Auto

pi 1 هفته پیش
والد
کامیت
421027fdd6
5فایلهای تغییر یافته به همراه215 افزوده شده و 10 حذف شده
  1. 95 0
      automations.yaml
  2. 12 6
      mqtt.yaml
  3. 67 0
      packages/stove.yaml
  4. 8 3
      pyscript/kitchen.py
  5. 33 1
      pyscript/state_goto.py

+ 95 - 0
automations.yaml

@@ -237,3 +237,98 @@
     target:
       entity_id: input_select.light_mode
   mode: single
+- id: '1769021614180'
+  alias: Workday Morning Auto-On Lights
+  description: Handles lighting based on week parity and Katja's start time
+  triggers:
+  - at: 05:30:00
+    id: katja_gets_up_on_extra_early_week
+    trigger: time
+  - at: 05:55:00
+    id: katja_gets_up_on_normal_early_week
+    trigger: time
+  - at: 06:25:00
+    id: katja_work_late
+    trigger: time
+  - at: 06:40:00
+    id: thomas_gets_up_when_we_go_together
+    trigger: time
+  conditions:
+  - condition: numeric_state
+    entity_id: sensor.outside_lux
+    below: 2
+  - condition: state
+    entity_id: binary_sensor.workday_sensor
+    state: 'on'
+  - condition: state
+    entity_id: input_boolean.workday_morning_auto_lights
+    state: 'on'
+  actions:
+  - choose:
+    - conditions:
+      - condition: trigger
+        id: katja_gets_up_on_extra_early_week
+      - condition: state
+        entity_id: sensor.morning_routine_mode
+        state: even_extra_early_day
+      sequence:
+      - target:
+          entity_id: input_select.light_mode
+        data:
+          option: Dimmed morning
+        action: input_select.select_option
+    - conditions:
+      - condition: trigger
+        id: katja_gets_up_on_normal_early_week
+      - condition: state
+        entity_id: sensor.morning_routine_mode
+        state: even_day
+      sequence:
+      - target:
+          entity_id: input_select.light_mode
+        data:
+          option: Dimmed morning
+        action: input_select.select_option
+    - conditions:
+      - condition: trigger
+        id: katja_work_late
+      - condition: template
+        value_template: '{{ states(''sensor.morning_routine_mode'') in [''odd_evening'',
+          ''even_extra_early_day''] }}'
+      sequence:
+      - target:
+          entity_id: input_select.light_mode
+        data:
+          option: Morning
+        action: input_select.select_option
+    - conditions:
+      - condition: trigger
+        id: thomas_gets_up_when_we_go_together
+      - condition: state
+        entity_id: sensor.morning_routine_mode
+        state: even_day
+      sequence:
+      - target:
+          entity_id: input_select.light_mode
+        data:
+          option: Morning
+        action: input_select.select_option
+  mode: single
+- id: '1770999169524'
+  alias: Pellet Stove Steady-State Fault Alert
+  description: ''
+  triggers:
+  - trigger: state
+    entity_id:
+    - binary_sensor.pellet_stove_steady_state_supervision_fault
+    from: 'off'
+    to: 'on'
+  conditions: []
+  actions:
+  - action: notify.mobile_app_pixel_8_pro
+    metadata: {}
+    data:
+      title: "\U0001F525 Pellet Stove Supervision Warning"
+      message: Steady-state combustion inconsistency detected. Check flame sensor
+        and fuel system.
+  mode: single

+ 12 - 6
mqtt.yaml

@@ -94,6 +94,16 @@ sensor:
         payload_not_available: "offline"
     unit_of_measurement: "°C"
 
+  - name: "Caravan Inside Temperature"
+    unique_id: "caravan_inside_temperature_A"
+    state_topic: "rf433/clas/2/state"
+    #value_template: "{{ value_json.values.temperature }}"
+    value_template: "{{ value_json['values']['temperature'] }}"
+    unit_of_measurement: "°C"
+    device_class: temperature
+    state_class: measurement
+    #availability_topic: "rf433/clas/2/state"
+
 
 # --------------------------------------- For Test ---------------------------------------
 
@@ -130,13 +140,9 @@ light:
     qos: 0
     brightness_scale: 1000
     brightness: true
+  
 
-
-
-
-
-
-
+# Example of Shelly1 Mini G3 light via RPC  
 #light:
 #    - name: "Front Door Light"
 #      schema: template

+ 67 - 0
packages/stove.yaml

@@ -0,0 +1,67 @@
+
+mqtt:
+
+  sensor:
+    # --- Mode (mapped int -> string) ---
+    - name: "Pellet Stove Mode"
+      state_topic: "pelletstove/state"
+      value_template: >
+        {% set m = value_json.mode | int %}
+        {% set modes = {
+          0: 'OFF',
+          2: 'STANDBY',
+          4: 'PRIME',
+          5: 'PRIMING',
+          6: 'IGNITION',
+          8: 'WARMUP',
+          10: 'HIGH HEAT',
+          12: 'LOW HEAT',
+          14: 'COOLING',
+          20: 'ON',
+          21: 'ALARM',
+          22: 'ALARM COOLDOWN',
+          23: 'OFF COOLDOWN',
+          24: 'STANDBY COOLDOWN',
+          25: 'STBY COOLDOWN',
+          40: 'TEST'
+        } %}
+        {{ modes.get(m, 'UNKNOWN') }}
+    
+    # --- Temperatures ---
+    - name: "Pellet Stove Flame Temp"
+      state_topic: "pelletstove/state"
+      value_template: "{{ value_json.tFlame }}"
+      unit_of_measurement: "°C"
+    
+    - name: "Pellet Stove Flue Temp"
+      state_topic: "pelletstove/state"
+      value_template: "{{ value_json.tFlue }}"
+      unit_of_measurement: "°C"
+    
+    - name: "Pellet Stove Feed Rate"
+      state_topic: "pelletstove/state"
+      value_template: "{{ value_json.feed }}"
+      unit_of_measurement: "%"
+      state_class: measurement
+
+
+template:
+  - binary_sensor:
+      - name: "Pellet Stove Steady-State Supervision Fault"
+        unique_id: pellet_stove_steady_state_fault
+        state: >
+          {% set mode = states('sensor.pellet_stove_mode') %}
+          {% set feed = states('sensor.pellet_stove_feed_rate') | float(0) %}
+          {% set flame = states('sensor.pellet_stove_flame_temp') | float(0) %}
+          {% set flue = states('sensor.pellet_stove_flue_temp') | float(0) %}
+
+          {% set steady_modes = ['HIGH HEAT', 'LOW HEAT', 'ON'] %}
+
+          {{
+            mode in steady_modes and (
+              (feed > 35 and flame < 200) or
+              (flame < 200 and flue > 120)
+            )
+          }}
+        delay_on: "00:01:30"
+        device_class: problem

+ 8 - 3
pyscript/kitchen.py

@@ -74,9 +74,14 @@ def handle_kitchen_worklights():
         light.turn_on(entity_id='light.kitchen_worktop_4k',brightness='63')
         light.turn_on(entity_id='light.kitchen_worktop_27k',brightness='127')
     elif( light.hall_door == 'on' ):
-        log.info("3. Kitchen LED. Soft mode...")
-        light.turn_off(entity_id='light.kitchen_worktop_4k')
-        light.turn_on(entity_id='light.kitchen_worktop_27k',brightness='12')
+        if( input_select.light_mode == 'Dimmed morning' ):
+            log.info("3. Kitchen LED. Dimmed soft mode...")
+            light.turn_off(entity_id='light.kitchen_worktop_4k')
+            light.turn_on(entity_id='light.kitchen_worktop_27k',brightness='3')
+        else:
+            log.info("3. Kitchen LED. Normal soft mode...")
+            light.turn_off(entity_id='light.kitchen_worktop_4k')
+            light.turn_on(entity_id='light.kitchen_worktop_27k',brightness='12')
     else:
         log.info("3. Kitchen LED. Off mode...")
         light.turn_off(entity_id='light.kitchen_worktop_4k')

+ 33 - 1
pyscript/state_goto.py

@@ -58,6 +58,9 @@ def monitor_light_mode_selector(value=None, old_value=None):
         elif value == 'Morning':
             log.info("Go to Morning")
             pyscript.state_goto_morning()
+        elif value == 'Dimmed morning':
+            log.info("Go to Dimmed morning")
+            pyscript.state_goto_dimmed_morning()
         elif value == 'Windows':
             log.info("Go to Windows")
             pyscript.state_goto_window()
@@ -159,7 +162,8 @@ def state_goto_morning():
     switch.turn_on(entity_id='switch.matsal_altandorr')
     switch.turn_off(entity_id='switch.matsal_piano')
     if( isChristmas ):
-        switch.turn_on(entity_id='switch.koksfonster')
+        switch.turn_off(entity_id='switch.koksfonster')
+        #switch.turn_on(entity_id='switch.koksfonster')
     else:
         switch.turn_off(entity_id='switch.koksfonster')
     light.turn_off(entity_id='light.hall_inner')
@@ -169,6 +173,34 @@ def state_goto_morning():
     light.turn_off(entity_id='light.shellydimmer1')
 
 
+    for x in range(2):
+        task.sleep(0.5)
+        if( isChristmas ):
+            light.turn_off(entity_id=' light.main_button_4') # Christmas lights
+            task.sleep(0.5)
+    
+    pyscript.kitchen_worklights_button_trigger()
+    #pyscript.handle_bedroom_light()
+
+@service
+def state_goto_dimmed_morning():
+    task.unique('state_goto_py')
+    isChristmas  = True if input_boolean.christmas == 'on' else False
+    log.info(f"********* DIMMED MORNING *********** State:{input_select.light_mode} Jul:{isChristmas}")
+    light.turn_off(entity_id='light.tradfri_bulb')
+    switch.turn_off(entity_id='switch.matsal_altandorr')
+    switch.turn_off(entity_id='switch.matsal_piano')
+    if( isChristmas ):
+        switch.turn_off(entity_id='switch.koksfonster')
+    else:
+        switch.turn_off(entity_id='switch.koksfonster')
+    light.turn_off(entity_id='light.hall_inner')
+    light.turn_on(entity_id='light.hall_door', brightness=3, color_temp_kelvin=2202)
+    light.turn_off(entity_id='light.rislampa')
+    switch.turn_off(entity_id='switch.sovrum')
+    light.turn_off(entity_id='light.shellydimmer1')
+
+
     for x in range(2):
         task.sleep(0.5)
         if( isChristmas ):