Skip to content

Commit

Permalink
Merge pull request #3 from vaninanton/test-v0.44
Browse files Browse the repository at this point in the history
test-v0.44
  • Loading branch information
vaninanton authored Jan 2, 2025
2 parents 0d44ad3 + e402b80 commit b8289db
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 21 deletions.
2 changes: 1 addition & 1 deletion esphome-gauhartas204-esp8266.factory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ dashboard_import:

# Sets up the improv via serial client for Wi-Fi provisioning.
# Handy if your device has a usb port for the user to add credentials when they first get it.
improv_serial:
# improv_serial:
52 changes: 35 additions & 17 deletions esphome-gauhartas204-esp8266.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ esp8266:

# To be able to get logs from the device via serial and api.
logger:
baud_rate: 0

# API is a requirement of the dashboard import.
api:
Expand Down Expand Up @@ -81,8 +82,8 @@ switch:
turn_off: "*1 PRT 4 0 $\r\n"

- platform: uart
name: "HallLight"
id: "HallLight"
name: "LobbyLight"
id: "LobbyLight"
icon: "mdi:ceiling-light-multiple-outline"
data:
turn_on: "*1 PRT 5 1 $\r\n"
Expand Down Expand Up @@ -173,36 +174,49 @@ button:
id: "alloff"
icon: "mdi:power"

# Вода перекрывается, сигнал об утечке
- platform: uart
entity_category: "diagnostic"
name: "status_wm_on"
data: "*WM ON$\r\n"
internal: true
name: "wm_alr"
data: "*WM ALR$\r\n"

- platform: uart
entity_category: "diagnostic"
name: "status_wm_off"
data: "*WM OFF$\r\n"
internal: true
name: "wm_on"
data: "*WM ON$\r\n"

- platform: uart
entity_category: "diagnostic"
name: "status_wm_inf"
data: "*WM INF$\r\n"
internal: true
name: "wm_off"
data: "*WM OFF$\r\n"

# - platform: uart
# entity_category: "diagnostic"
# name: "wm_wsd"
# data: "*WM WSD$\r\n"

# - platform: uart
# entity_category: "diagnostic"
# name: "rk_wm_low"
# data: "*RK WM LOW$\r\n"

# - platform: uart
# entity_category: "diagnostic"
# name: "wm_reb"
# data: "*WM REB$\r\n"

- platform: restart
entity_category: "diagnostic"
name: "Restart ESPHOME"
internal: true

valve:
- platform: template
name: "water"
id: "rkwm"
device_class: water
icon: "mdi:water"
optimistic: true
optimistic: false
has_position: false
open_action:
- uart.write:
data: "*WM ON$\r\n"
Expand All @@ -219,8 +233,9 @@ text_sensor:
return {uart_readline_sensor};
text_sensors:
- name: "latestSerial"
internal: true
entity_category: "diagnostic"
- platform: version
name: "ESPHome Version"

interval:
- interval: 120s
Expand All @@ -230,8 +245,11 @@ interval:
- delay: 3s
- uart.write:
data: "*2 STS$\r\n"

- interval: 120s
then:
- delay: 3s
- uart.write:
data: "*WM INF$\r\n"

status_led:
pin:
number: D4
inverted: true
8 changes: 5 additions & 3 deletions uart_read_line_sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,15 @@ class UartReadLineSensor : public Component, public UARTDevice, public TextSenso
// *RA 2 0 0 0 0 0 0 0 0 $
// *RK WM ON$
// *RK WM OFF$
// *RK WM ALR$
if (buffer[0] == '*' && buffer[1] == 'R' && buffer[2] == 'A' && buffer[4] == '1')
{
// id(prt10).publish_state(buffer[6] == '1');
id(BathroomLight).publish_state(buffer[8] == '1');
id(BathroomHall).publish_state(buffer[10] == '1');
id(KitchenLight).publish_state(buffer[12] == '1');
id(KitchenTable).publish_state(buffer[14] == '1');
id(HallLight).publish_state(buffer[16] == '1');
id(LobbyLight).publish_state(buffer[16] == '1');
id(LivingroomSubLight).publish_state(buffer[18] == '1');
id(BathroomSubLight).publish_state(buffer[20] == '1');
}
Expand All @@ -107,9 +108,10 @@ class UartReadLineSensor : public Component, public UARTDevice, public TextSenso
id(LivingroomLight).publish_state(buffer[18] == '1');
id(SleepingroomWardrobe).publish_state(buffer[20] == '1');
}
else if (buffer[0] == '*' && buffer[1] == 'R' && buffer[2] == 'K' && buffer[4] == 'W' && buffer[5] == 'M')
else if (buffer[0] == '*' && buffer[1] == 'R' && buffer[2] == 'K' && buffer[3] == ' ' && buffer[4] == 'W' && buffer[5] == 'M' && buffer[6] == ' ')
{
id(rkwm).publish_state(buffer[8] == 'N');
id(rkwm).position = buffer[8] == 'F' || buffer[8] == 'L' ? VALVE_CLOSED : VALVE_OPEN;
id(rkwm).publish_state();
}
}
}
Expand Down

0 comments on commit b8289db

Please sign in to comment.