diff --git a/common/everything-presence-one-base.yaml b/common/everything-presence-one-base.yaml index ea9bf31..11bd1d5 100644 --- a/common/everything-presence-one-base.yaml +++ b/common/everything-presence-one-base.yaml @@ -133,120 +133,7 @@ binary_sensor: return id(occupancy).state; } -switch: - - platform: template - name: mmWave sensor - id: mmwave_sensor - disabled_by_default: True - entity_category: config - optimistic: true - restore_mode: DISABLED - turn_on_action: - - uart.write: "sensorStart" - - delay: 1s - turn_off_action: - - uart.write: "sensorStop" - - delay: 1s - - - platform: template - name: UART presence output - id: uart_presence_output - entity_category: config - internal: ${uart_presence_output_disabled} - optimistic: true - turn_on_action: - - logger.log: "UART Presence Output On" - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: "setUartOutput 1 1" - - delay: 1s - - uart.write: "saveConfig" - - delay: 3s - - switch.turn_on: mmwave_sensor - turn_off_action: - - logger.log: "UART Presence Output Off" - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: "setUartOutput 1 0" - - delay: 1s - - uart.write: "saveConfig" - - delay: 3s - - switch.turn_on: mmwave_sensor - number: - - platform: template - name: mmWave off latency - icon: mdi:clock-end - entity_category: config - id: mmwave_off_latency - min_value: 1 - max_value: 600 - initial_value: 15 - optimistic: true - step: 5 - restore_value: true - unit_of_measurement: seconds - mode: slider - set_action: - - logger.log: "Off latency set" - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: !lambda |- - std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state); - return std::vector(mss.begin(), mss.end()); - - delay: 1s - - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89" - - delay: 1s - - switch.turn_on: mmwave_sensor - - - platform: template - name: mmWave on latency - icon: mdi:clock-start - id: mmwave_on_latency - entity_category: config - min_value: 0 - max_value: 2 - initial_value: 0 - optimistic: true - step: 0.25 - restore_value: true - unit_of_measurement: seconds - mode: slider - set_action: - - logger.log: "On latency set" - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: !lambda |- - std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state); - return std::vector(mss.begin(), mss.end()); - - delay: 1s - - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89" - - delay: 1s - - switch.turn_on: mmwave_sensor - - - platform: template - name: mmWave sensitivity - icon: mdi:target-variant - id: mmwave_sensitivity - entity_category: config - min_value: 0 - max_value: 9 - initial_value: 7 - optimistic: true - step: 1 - restore_value: true - set_action: - - logger.log: "Sensitivity set" - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: - !lambda std::string mss = "setSensitivity " + to_string((int)x); - return std::vector(mss.begin(), mss.end()); - - delay: 1s - - uart.write: "saveConfig" - - delay: 1s - - switch.turn_on: mmwave_sensor - - platform: template name: Occupancy off latency icon: mdi:clock-end @@ -329,35 +216,8 @@ button: id: restart_internal entity_category: config internal: true - - platform: template - name: Restart mmWave sensor - id: restart_mmwave - entity_category: config - internal: true - on_press: - - uart.write: "resetSystem" - - platform: template - name: Restart - icon: mdi:restart - entity_category: config - disabled_by_default: True - on_press: - - button.press: restart_mmwave - - button.press: restart_internal - platform: safe_mode internal: false name: Safe mode entity_category: config - disabled_by_default: True - - platform: template - name: Factory reset mmWave - icon: mdi:cog-counterclockwise - id: factory_reset_mmwave - internal: ${factory_reset_disabled} - entity_category: config - on_press: - - switch.turn_off: mmwave_sensor - - delay: 1s - - uart.write: "resetCfg" - - delay: 3s - - switch.turn_on: mmwave_sensor \ No newline at end of file + disabled_by_default: True \ No newline at end of file diff --git a/common/everything-presence-one-sen0395-beta.yaml b/common/everything-presence-one-sen0395-beta.yaml index 9d8e0a3..c98682a 100644 --- a/common/everything-presence-one-sen0395-beta.yaml +++ b/common/everything-presence-one-sen0395-beta.yaml @@ -74,32 +74,6 @@ uart: } } -light: - - platform: binary - name: mmWave LED - output: mmwave_led_output - entity_category: config - disabled_by_default: True - -output: - - platform: template - id: mmwave_led_output - type: binary - write_action: - - switch.turn_off: mmwave_sensor - - delay: 1s - - if: - condition: - lambda: !lambda return state; - then: - - uart.write: "setLedMode 1 0" - else: - - uart.write: "setLedMode 1 1" - - delay: 1s - - uart.write: "saveConfig" - - delay: 3s - - switch.turn_on: mmwave_sensor - number: - platform: template id: mmwave_zone_1_start diff --git a/common/everything-presence-one-sen0395-stable.yaml b/common/everything-presence-one-sen0395-stable.yaml index be12a76..18ae510 100644 --- a/common/everything-presence-one-sen0395-stable.yaml +++ b/common/everything-presence-one-sen0395-stable.yaml @@ -11,32 +11,6 @@ uart: sequence: - lambda: UARTDebug::log_string(direction, bytes); -light: - - platform: binary - name: mmWave LED - output: mmwave_led_output - entity_category: config - disabled_by_default: True - -output: - - platform: template - id: mmwave_led_output - type: binary - write_action: - - switch.turn_off: mmwave_sensor - - delay: 1s - - if: - condition: - lambda: !lambda return state; - then: - - uart.write: "setLedMode 1 0" - else: - - uart.write: "setLedMode 1 1" - - delay: 1s - - uart.write: "saveConfig" - - delay: 3s - - switch.turn_on: mmwave_sensor - binary_sensor: - platform: gpio name: mmWave @@ -45,7 +19,7 @@ binary_sensor: pin: number: GPIO15 mode: INPUT_PULLDOWN - + number: - platform: template id: mmwave_distance diff --git a/common/sen0395-common.yaml b/common/sen0395-common.yaml new file mode 100644 index 0000000..f9a0c17 --- /dev/null +++ b/common/sen0395-common.yaml @@ -0,0 +1,168 @@ +button: + - platform: template + name: Restart mmWave sensor + id: restart_mmwave + entity_category: config + internal: true + on_press: + - uart.write: "resetSystem" + - platform: template + name: Restart + icon: mdi:restart + entity_category: config + disabled_by_default: True + on_press: + - button.press: restart_mmwave + - button.press: restart_internal + - platform: template + name: Factory reset mmWave + icon: mdi:cog-counterclockwise + id: factory_reset_mmwave + internal: ${factory_reset_disabled} + entity_category: config + on_press: + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: "resetCfg" + - delay: 3s + - switch.turn_on: mmwave_sensor + +light: + - platform: binary + name: mmWave LED + output: mmwave_led_output + entity_category: config + disabled_by_default: False + +output: + - platform: template + id: mmwave_led_output + type: binary + write_action: + - switch.turn_off: mmwave_sensor + - delay: 1s + - if: + condition: + lambda: !lambda return state; + then: + - uart.write: "setLedMode 1 0" + else: + - uart.write: "setLedMode 1 1" + - delay: 1s + - uart.write: "saveConfig" + - delay: 3s + - switch.turn_on: mmwave_sensor + +number: + - platform: template + name: mmWave off latency + icon: mdi:clock-end + entity_category: config + id: mmwave_off_latency + min_value: 1 + max_value: 600 + initial_value: 15 + optimistic: true + step: 5 + restore_value: true + unit_of_measurement: seconds + mode: slider + set_action: + - logger.log: "Off latency set" + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: !lambda |- + std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state); + return std::vector(mss.begin(), mss.end()); + - delay: 1s + - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89" + - delay: 1s + - switch.turn_on: mmwave_sensor + + - platform: template + name: mmWave on latency + icon: mdi:clock-start + id: mmwave_on_latency + entity_category: config + min_value: 0 + max_value: 2 + initial_value: 0 + optimistic: true + step: 0.25 + restore_value: true + unit_of_measurement: seconds + mode: slider + set_action: + - logger.log: "On latency set" + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: !lambda |- + std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state); + return std::vector(mss.begin(), mss.end()); + - delay: 1s + - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89" + - delay: 1s + - switch.turn_on: mmwave_sensor + + - platform: template + name: mmWave sensitivity + icon: mdi:target-variant + id: mmwave_sensitivity + entity_category: config + min_value: 0 + max_value: 9 + initial_value: 7 + optimistic: true + step: 1 + restore_value: true + set_action: + - logger.log: "Sensitivity set" + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: + !lambda std::string mss = "setSensitivity " + to_string((int)x); + return std::vector(mss.begin(), mss.end()); + - delay: 1s + - uart.write: "saveConfig" + - delay: 1s + - switch.turn_on: mmwave_sensor + +switch: + - platform: template + name: mmWave sensor + id: mmwave_sensor + disabled_by_default: True + entity_category: config + optimistic: true + restore_mode: DISABLED + turn_on_action: + - uart.write: "sensorStart" + - delay: 1s + turn_off_action: + - uart.write: "sensorStop" + - delay: 1s + + - platform: template + name: UART presence output + id: uart_presence_output + entity_category: config + internal: ${uart_presence_output_disabled} + optimistic: true + turn_on_action: + - logger.log: "UART Presence Output On" + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: "setUartOutput 1 1" + - delay: 1s + - uart.write: "saveConfig" + - delay: 3s + - switch.turn_on: mmwave_sensor + turn_off_action: + - logger.log: "UART Presence Output Off" + - switch.turn_off: mmwave_sensor + - delay: 1s + - uart.write: "setUartOutput 1 0" + - delay: 1s + - uart.write: "saveConfig" + - delay: 3s + - switch.turn_on: mmwave_sensor \ No newline at end of file diff --git a/everything-presence-one-beta-ble.yaml b/everything-presence-one-beta-ble.yaml index a78832c..de2d03b 100644 --- a/everything-presence-one-beta-ble.yaml +++ b/everything-presence-one-beta-ble.yaml @@ -2,7 +2,7 @@ substitutions: name: "everything-presence-one" friendly_name: "Everything Presence One" project_name: "Everything Smart Technology.Everything Presence One" - project_version: "1.3.5b" + project_version: "1.3.6b" temperature_offset: "-3" humidity_offset: "5" temperature_update_interval: "60s" @@ -20,4 +20,5 @@ dashboard_import: packages: device_base: !include common/everything-presence-one-base.yaml device_version: !include common/everything-presence-one-sen0395-beta.yaml - bluetooth_base: !include common/bluetooth-base.yaml \ No newline at end of file + bluetooth_base: !include common/bluetooth-base.yaml + sen0395_base: !include common/sen0395-common.yaml \ No newline at end of file diff --git a/everything-presence-one-beta.yaml b/everything-presence-one-beta.yaml index 4e9e262..1e0ac4d 100644 --- a/everything-presence-one-beta.yaml +++ b/everything-presence-one-beta.yaml @@ -2,7 +2,7 @@ substitutions: name: "everything-presence-one" friendly_name: "Everything Presence One" project_name: "Everything Smart Technology.Everything Presence One" - project_version: "1.3.5b" + project_version: "1.3.6b" temperature_offset: "-3" humidity_offset: "5" temperature_update_interval: "60s" @@ -19,4 +19,5 @@ dashboard_import: packages: device_base: !include common/everything-presence-one-base.yaml - device_version: !include common/everything-presence-one-sen0395-beta.yaml \ No newline at end of file + device_version: !include common/everything-presence-one-sen0395-beta.yaml + sen0395_base: !include common/sen0395-common.yaml \ No newline at end of file diff --git a/everything-presence-one-ble.yaml b/everything-presence-one-ble.yaml index cac7351..1ea7de2 100644 --- a/everything-presence-one-ble.yaml +++ b/everything-presence-one-ble.yaml @@ -2,7 +2,7 @@ substitutions: name: "everything-presence-one" friendly_name: "Everything Presence One" project_name: "Everything Smart Technology.Everything Presence One" - project_version: "1.2.1" + project_version: "1.2.2" temperature_offset: "-3" humidity_offset: "5" temperature_update_interval: "60s" @@ -20,4 +20,5 @@ dashboard_import: packages: device_base: !include common/everything-presence-one-base.yaml device_version: !include common/everything-presence-one-sen0395-stable.yaml - bluetooth_base: !include common/bluetooth-base.yaml \ No newline at end of file + bluetooth_base: !include common/bluetooth-base.yaml + sen0395_base: !include common/sen0395-common.yaml \ No newline at end of file diff --git a/everything-presence-one.yaml b/everything-presence-one.yaml index 6eca2c6..9e7700c 100644 --- a/everything-presence-one.yaml +++ b/everything-presence-one.yaml @@ -2,7 +2,7 @@ substitutions: name: "everything-presence-one" friendly_name: "Everything Presence One" project_name: "Everything Smart Technology.Everything Presence One" - project_version: "1.2.1" + project_version: "1.2.2" temperature_offset: "-3" humidity_offset: "5" temperature_update_interval: "60s" @@ -19,4 +19,5 @@ dashboard_import: packages: device_base: !include common/everything-presence-one-base.yaml - device_version: !include common/everything-presence-one-sen0395-stable.yaml \ No newline at end of file + device_version: !include common/everything-presence-one-sen0395-stable.yaml + sen0395_base: !include common/sen0395-common.yaml \ No newline at end of file