From 07a74e534eb913c5554f679f92eff398923d223a Mon Sep 17 00:00:00 2001 From: Jan Grewe <jan@faked.org> Date: Mon, 31 Mar 2025 01:03:28 +0200 Subject: [PATCH] add Nous A8T (mombox light & fan) --- mombox-fan.yaml | 8 +++++ mombox-light.yaml | 8 +++++ packages/nous_a8t.yaml | 82 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 mombox-fan.yaml create mode 100644 mombox-light.yaml create mode 100644 packages/nous_a8t.yaml diff --git a/mombox-fan.yaml b/mombox-fan.yaml new file mode 100644 index 0000000..0e8af1d --- /dev/null +++ b/mombox-fan.yaml @@ -0,0 +1,8 @@ +substitutions: + devicename: "mombox-fan" + comment: "Mother Fan Control" + +packages: + base: !include packages/base.yaml + time: !include packages/time.yaml + nous_a8t: !include packages/nous_a8t.yaml diff --git a/mombox-light.yaml b/mombox-light.yaml new file mode 100644 index 0000000..1d94cee --- /dev/null +++ b/mombox-light.yaml @@ -0,0 +1,8 @@ +substitutions: + devicename: "mombox-light" + comment: "Mother Light Control" + +packages: + base: !include packages/base.yaml + time: !include packages/time.yaml + nous_a8t: !include packages/nous_a8t.yaml diff --git a/packages/nous_a8t.yaml b/packages/nous_a8t.yaml new file mode 100644 index 0000000..5950621 --- /dev/null +++ b/packages/nous_a8t.yaml @@ -0,0 +1,82 @@ +substitutions: + # Higher value gives lower watt readout + current_res: "0.00126" + # Lower value gives lower voltage readout + voltage_div: "1570" + +esp32: + board: esp32dev + +light: + - platform: status_led + id: led_status + pin: + number: GPIO2 + inverted: true + +binary_sensor: + - platform: gpio + id: button_state + pin: + number: GPIO04 + mode: INPUT_PULLUP + on_press: + - switch.toggle: power + +switch: + - platform: template + name: "Power" + id: power + restore_mode: RESTORE_DEFAULT_OFF + lambda: |- + if (id(relay).state) { + return true; + } else { + return false; + } + turn_on_action: + - switch.turn_on: relay + - light.turn_on: led_status + turn_off_action: + - switch.turn_off: relay + - light.turn_off: led_status + - platform: gpio + id: relay + pin: GPIO13 + +sensor: + - platform: total_daily_energy + name: "Daily Consumption" + power_id: watt + filters: + # Multiplication factor from W to kW is 0.001 + - multiply: 0.001 + unit_of_measurement: kWh + + - platform: hlw8012 + model: BL0937 + sel_pin: + number: GPIO14 + inverted: True + cf_pin: GPIO27 + cf1_pin: GPIO26 + change_mode_every: 1 + current_resistor: ${current_res} + voltage_divider: ${voltage_div} + update_interval: 3s + + current: + name: "Ampere" + unit_of_measurement: A + accuracy_decimals: 3 + + voltage: + name: "Volt" + unit_of_measurement: V + accuracy_decimals: 1 + + power: + id: watt + name: "Watt" + unit_of_measurement: W + accuracy_decimals: 1 -- GitLab