Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New venetian blind functionality added for shutters #13598

Merged
merged 9 commits into from
Nov 9, 2021
2 changes: 2 additions & 0 deletions tasmota/i18n.h
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@
#define D_CMND_SHUTTER_INVERTWEBBUTTONS "InvertWebButtons"
#define D_CMND_SHUTTER_PWMRANGE "PWMRange"
#define D_CMND_SHUTTER_UNITTEST "UnitTest"
#define D_CMND_SHUTTER_TILTCONFIG "TiltConfig"
#define D_CMND_SHUTTER_SETTILT "Tilt"

// Commands xdrv_32_hotplug.ino
#define D_CMND_HOTPLUG "HotPlug"
Expand Down
4 changes: 3 additions & 1 deletion tasmota/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,9 @@ typedef struct {
uint16_t influxdb_port; // 4CE
power_t interlock[MAX_INTERLOCKS_SET]; // 4D0 MAX_INTERLOCKS = MAX_RELAYS / 2

uint8_t free_508[36]; // 508
int8_t shutter_tilt_config[5][MAX_SHUTTERS]; //508
int8_t shutter_tilt_pos[MAX_SHUTTERS]; //51C
uint8_t free_520[12]; // 520

uint16_t mqtt_keepalive; // 52C
uint16_t mqtt_socket_timeout; // 52E
Expand Down
23 changes: 22 additions & 1 deletion tasmota/xdrv_12_home_assistant.ino
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,24 @@ const char HASS_DISCOVER_SHUTTER_POS[] PROGMEM =
"\"pos_open\":100,"
"\"set_pos_t\":\"%s%d\""; // cmnd/%topic%/ShutterPosition1

const char HASS_DISCOVER_SHUTTER_TILT[] PROGMEM =
",\"tilt_cmd_t\":\"%s%d\"," // cmnd/%topic%/ShutterTilt1
"\"tilt_opnd_val\":%d,"
"\"tilt_clsd_val\":%d";

/*
"tilt_clsd_val": "tilt_closed_value",
"tilt_cmd_t": "tilt_command_topic",
"tilt_cmd_tpl": "tilt_command_template",
"tilt_inv_stat": "tilt_invert_state",
"tilt_max": "tilt_max",
"tilt_min": "tilt_min",
"tilt_opnd_val": "tilt_opened_value",
"tilt_opt": "tilt_optimistic",
"tilt_status_t": "tilt_status_topic",
"tilt_status_tpl": "tilt_status_template",
*/

const char HASS_DISCOVER_SENSOR_HASS_STATUS[] PROGMEM =
",\"json_attr_t\":\"%s\","
"\"unit_of_meas\":\"%%\","
Expand Down Expand Up @@ -1020,7 +1038,10 @@ void HAssAnnounceShutters(void)
GetTopic_P(stemp1, STAT, TasmotaGlobal.mqtt_topic, PSTR("SHUTTER"));
GetTopic_P(stemp2, CMND, TasmotaGlobal.mqtt_topic, PSTR("ShutterPosition"));
TryResponseAppend_P(HASS_DISCOVER_SHUTTER_POS, stemp1, i + 1, stemp2, i + 1);


GetTopic_P(stemp1, CMND, TasmotaGlobal.mqtt_topic, PSTR("ShutterTilt"));
TryResponseAppend_P(HASS_DISCOVER_SHUTTER_TILT, stemp1, i + 1, Settings->shutter_tilt_config[3][i], Settings->shutter_tilt_config[4][i]);

TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP_getChipId());
TryResponseAppend_P(PSTR("}"));
} else {
Expand Down
Loading