Skip to content

Commit

Permalink
Add support for Pro Dual Cover PM (#224)
Browse files Browse the repository at this point in the history
* Add Pro Dual Cover PM

* Update docs
  • Loading branch information
bieniu authored Jun 18, 2023
1 parent 53cf5e1 commit 2ddb634
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Shellies Discovery Gen2 will automatically install/update the script on your She
- Shelly Pro 3
- Shelly Pro 3EM
- Shelly Pro 4PM
- Shelly Pro Dual Cover PM
- Shelly Pro EM
- Shelly Wall Display

Expand Down
1 change: 1 addition & 0 deletions info.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Shellies Discovery Gen2 will automatically install/update the script on your She
- Shelly Pro 3
- Shelly Pro 3EM
- Shelly Pro 4PM
- Shelly Pro Dual Cover PM
- Shelly Pro EM
- Shelly Wall Display

Expand Down
41 changes: 40 additions & 1 deletion python_scripts/shellies_discovery_gen2.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
MODEL_PRO_2 = "shellypro2"
MODEL_PRO_2PM = "shellypro2pm"
MODEL_PRO_3 = "shellypro3"
MODEL_PRO_DUAL_COVER_PM = "shellypro2cover"
MODEL_PRO_EM = "shellyproem50"
MODEL_PRO_3EM = "shellypro3em"
MODEL_PRO_4PM = "shellypro4pm"
Expand Down Expand Up @@ -1318,6 +1319,41 @@
},
ATTR_MIN_FIRMWARE_DATE: 20220308,
},
MODEL_PRO_DUAL_COVER_PM: {
ATTR_NAME: "Shelly Pro Dual Cover PM",
ATTR_MODEL_ID: "SPSH-002PE16EU",
ATTR_BINARY_SENSORS: {SENSOR_CLOUD: DESCRIPTION_SENSOR_CLOUD},
ATTR_BUTTONS: {BUTTON_RESTART: DESCRIPTION_BUTTON_RESTART},
ATTR_INPUTS: 4,
ATTR_INPUT_BINARY_SENSORS: {SENSOR_INPUT: DESCRIPTION_SENSOR_INPUT},
ATTR_INPUT_EVENTS: [
EVENT_SINGLE_PUSH,
EVENT_DOUBLE_PUSH,
EVENT_LONG_PUSH,
EVENT_TRIPLE_PUSH,
],
ATTR_COVERS: 2,
ATTR_COVER_SENSORS: {
SENSOR_CURRENT: DESCRIPTION_SENSOR_CURRENT_COVER,
SENSOR_ENERGY: DESCRIPTION_SENSOR_ENERGY_COVER,
SENSOR_POWER: DESCRIPTION_SENSOR_POWER_COVER,
SENSOR_POWER_FACTOR: DESCRIPTION_SENSOR_POWER_FACTOR_COVER,
SENSOR_TEMPERATURE: DESCRIPTION_SENSOR_COVER_TEMPERATURE,
SENSOR_VOLTAGE: DESCRIPTION_SENSOR_VOLTAGE_COVER,
},
ATTR_SENSORS: {
SENSOR_ETH_IP: DESCRIPTION_SENSOR_ETH_IP,
SENSOR_LAST_RESTART: DESCRIPTION_SENSOR_LAST_RESTART,
SENSOR_SSID: DESCRIPTION_SENSOR_SSID,
SENSOR_WIFI_IP: DESCRIPTION_SENSOR_WIFI_IP,
SENSOR_WIFI_SIGNAL: DESCRIPTION_SENSOR_WIFI_SIGNAL,
},
ATTR_UPDATES: {
UPDATE_FIRMWARE: DESCRIPTION_UPDATE_FIRMWARE,
UPDATE_FIRMWARE_BETA: DESCRIPTION_UPDATE_FIRMWARE_BETA,
},
ATTR_MIN_FIRMWARE_DATE: 20230425,
},
MODEL_PRO_EM: {
ATTR_NAME: "Shelly Pro EM",
ATTR_MODEL_ID: "SPEM-002CEBEU50",
Expand Down Expand Up @@ -1916,7 +1952,10 @@ def configure_device():
"""Create configuration for the device."""
config = {}

profile = device_config["sys"]["device"].get("profile", ATTR_SWITCH)
if model == MODEL_PRO_DUAL_COVER_PM:
profile = ATTR_COVER
else:
profile = device_config["sys"]["device"].get("profile", ATTR_SWITCH)

for cover_id in range(covers):
topic, payload = get_cover(cover_id, profile)
Expand Down
1 change: 1 addition & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ select = [
]

ignore = [
"C901", # too complex
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D404", # First word of the docstring should not be This
Expand Down

0 comments on commit 2ddb634

Please sign in to comment.