Przeglądaj źródła

Started some tempelating.

Thomas Chef 4 lat temu
rodzic
commit
e370216328
5 zmienionych plików z 93 dodań i 10 usunięć
  1. 3 0
      .gitignore
  2. 14 2
      configuration.yaml
  3. 19 8
      packages/ext_lights.yaml
  4. 49 0
      packages/test_stuff.yaml
  5. 8 0
      pyscript/example.py

+ 3 - 0
.gitignore

@@ -4,6 +4,9 @@
 !/.gitignore
 !/.travis.yml
 
+._.DS_Store
+/custom_components/
+
 # Logs
 logs
 *.log

+ 14 - 2
configuration.yaml

@@ -13,7 +13,6 @@ logger:
 homeassistant:
   packages: !include_dir_named packages
 
-binary_sensor:
 counter:
 logbook:
 notify:
@@ -24,6 +23,8 @@ input_select:
 input_text:
 timer:
 #websocket_api
+pyscript:
+  allow_all_imports: true
 
 system_health:
 recorder:
@@ -38,6 +39,17 @@ rflink:
   port: 12345
   wait_for_ack: false
 
+
+# All off (group) 20;01;NewKaku;ID=006d7076;;SWITCH=0;CMD=ALLOFF;
+
+binary_sensor:
+  - platform: rflink
+    devices:
+      newkaku_00066542_0:
+        name: Ytterdörr brytare
+        device_class: motion
+        off_delay: 5  
+
 sensor:
   - platform: rflink
     automatic_add: true
@@ -50,7 +62,7 @@ sensor:
         column: 'data'
         unit_of_measurement: Lux
       - name: Exterior light status
-        query: "SELECT onOff FROM RemoteRxLog.nexaLog where remote_id = '20071094' and button='1' order by ts desc LIMIT 1;"
+        query: "SELECT onOff FROM RemoteRxLog.nexaLog where rxTx='R' and remote_id = '20071094' and button='1' order by ts desc LIMIT 1;"
         column: 'onOff'
       - name: Outside temperature
         query: "SELECT temp1 FROM RemoteRxLog.temp order by ts desc LIMIT 1;"

+ 19 - 8
packages/ext_lights.yaml

@@ -18,6 +18,7 @@ input_boolean:
   ext_light_on_done:
     name: Bool switch, Ext light turned ON
     icon: mdi:car
+
   ext_light_off_done:
     name: Bool switch, Ext light turned OFF
     icon: mdi:car
@@ -28,11 +29,16 @@ automation:
     trigger:
     - platform: numeric_state
       entity_id: sensor.lux_outside_the_garage
-      below: '100'
+      below: 100
     condition:
-    - condition: state
-      entity_id: input_boolean.ext_light_on_done
-      state: 'off'
+      condition: and
+      conditions:
+        - condition: state
+          entity_id: input_boolean.ext_light_on_done
+          state: 'off'
+        - condition: state
+          entity_id: light.exterior_lights
+          state: 'off'
     action:
     - service: light.turn_on
       data: {}
@@ -51,11 +57,16 @@ automation:
     trigger:
     - platform: numeric_state
       entity_id: sensor.lux_outside_the_garage
-      above: '50'
+      above: 50
     condition:
-    - condition: state
-      entity_id: input_boolean.ext_light_off_done
-      state: 'off'
+      condition: and
+      conditions:
+        - condition: state
+          entity_id: input_boolean.ext_light_off_done
+          state: 'off'
+        - condition: state
+          entity_id: light.exterior_lights
+          state: 'on'
     action:
     - service: light.turn_off
       data: {}

+ 49 - 0
packages/test_stuff.yaml

@@ -0,0 +1,49 @@
+
+
+light:
+  - platform: rflink
+    devices:
+      newkaku_013242b6_2:
+        name: Piano-lamp
+        type: switchable
+      newkaku_013242b5_2:
+        name: Piano-lamp REPEATER
+        type: switchable
+
+sensor:
+  - platform: sql
+    db_url: mysql://hassio:hassiopassword@192.168.1.110/RemoteRxLog
+    queries:
+      - name: Piano-lamp repeater status
+        query: "SELECT IF(onOff>0,'on','off') AS status FROM RemoteRxLog.nexaLog where rxTx='R' and remote_id = '20071094' and button='2' order by ts desc LIMIT 1;"
+        column: 'status'
+
+input_boolean:
+  piano_light_wanted_state:
+    name: Piano-lamp, wanted state
+    initial: off
+    icon: mdi:lightbulb
+
+automation:
+  - alias: Piano-lamp control automation
+    trigger:
+      platform: template
+      value_template: >
+        {% if state_attr('sensor.piano_lamp_repeater_status', 'status') == states('input_boolean.piano_light_wanted_state') %}
+          false
+        {% else %}
+          true
+        {% endif %}
+    action:
+    - service: >
+        {% if states('input_boolean.piano_light_wanted_state') == "on" %}
+          light.turn_on
+        {% else %}
+          light.turn_off
+        {% endif %}
+      entity_id: light.piano_lamp_repeater
+
+
+timer:
+  piano_lamp_control_timer:
+    duration: '00:00:30'

+ 8 - 0
pyscript/example.py

@@ -0,0 +1,8 @@
+@service
+def hello_world(action=None, id=None):
+    """hello_world example using pyscript."""
+    log.info(f"XXXXX    THOMAS      hello world: got action {action} id {id}")
+    if action == "turn_on" and id is not None:
+        light.turn_on(entity_id=id, brightness=255)
+    elif action == "fire" and id is not None:
+        event.fire(id, param1=12, pararm2=80)