Skip to content

Commit

Permalink
Remove zhimqtt (error on 2023.4.1); Fix into mqtt.switch
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonsm committed Apr 10, 2023
1 parent ae3429c commit 9cf43de
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .HA_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023.3.5
2023.4.1
2 changes: 1 addition & 1 deletion configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ weather:
name: 天气

#sensor: !include sensors.yaml
switch: !include switches.yaml
#switch: !include switches.yaml
light: !include lights.yaml
fan: !include fans.yaml
mqtt: !include mqtt.yaml
Expand Down
10 changes: 9 additions & 1 deletion extras/setup/HassFix.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
cd /usr/lib/python3.10/site-packages/homeassistant
cd /usr/src/homeassistant/homeassistant
cd /usr/lib/python3.10/site-packages/homeassistant

sed -i 's/_LOGGER.warning(CUSTOM_WARNING/#LOGGER.warning(CUSTOM_WARNING/' loader.py
sed -i 's/minutes=30/days=30/' auth/const.py
Expand All @@ -11,3 +11,11 @@ sed -i 's/Platform.BUTTON/#latform.BUTTON/' components/braviatv/__init__.py
sed -i 's/f"{ATTR_MANUFACTURER} {model}"/model/' components/braviatv/entity.py

sed -i 's/"RM4PRO", "RM4MINI"/"RM4PRO", "RMPRO", "RM4MINI"/' components/broadlink/sensor.py

sed -i 's/await hass.config_entries.async_forward_entry_setups/#wait hass.config_entries.async_forward_entry_setups/' components/sun/__init__.py
sed -i 's/await hass.config_entries.async_unload_platforms/True or await hass.config_entries.async_unload_platforms/' components/sun/__init__.py

grep 'CONF_ICON_TEMPLATE,' components/mqtt/switch.py || sed -i 's/CONF_VALUE_TEMPLATE,/CONF_VALUE_TEMPLATE, CONF_ICON_TEMPLATE,/' components/mqtt/switch.py
grep 'CONF_ICON_TEMPLATE)' components/mqtt/switch.py || sed -i 's/cv.template,/cv.template, vol.Optional(CONF_ICON_TEMPLATE): cv.template,/' components/mqtt/switch.py
grep '"original_state": m' components/mqtt/switch.py || sed -i 's/payload = self._value_template/if CONF_VALUE_TEMPLATE in self._config: self._attr_state_attributes = {"original_state": msg.payload}\n if CONF_ICON_TEMPLATE in self._config: self._attr_icon = self._config[CONF_ICON_TEMPLATE].async_render_with_possible_json_value(msg.payload)\n payload = self._value_template/' components/mqtt/switch.py
grep 'state_attributes(s,' components/mqtt/switch.py || sed -i 's/def _prepare_subscribe_topics/@property\n def state_attributes(self): return self._attr_state_attributes if hasattr(self, "_attr_state_attributes") else None\n\n def _prepare_subscribe_topics/' components/mqtt/switch.py
10 changes: 6 additions & 4 deletions mqtt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ switch:
command_topic: Hassmart2/relay/1/set
availability_topic: Hassmart2/status
icon: mdi:fan
# - name: 浴室排气扇
# state_topic: Hassmart3/relay/0
# command_topic: Hassmart3/relay/0/set
# availability_topic: Hassmart3/status
- name: 书房音箱
state_topic: NodeMCU2/relay/0
command_topic: NodeMCU2/relay/0/set
availability_topic: NodeMCU2/status
value_template: '{% if value == "关闭" %}OFF{% else %}ON{% endif %}'
icon_template: '{% if value == "关闭" %}mdi:speaker-off{% elif value == "蓝牙" %}mdi:speaker-bluetooth{% elif value == "光纤" %}mdi:speaker-wireless{% elif value == "优盘" %}mdi:usb{% elif value == "辅助" %}mdi:video-input-component{% else %}mdi:speaker{% endif %}'

light:
- name: 客厅筒灯
Expand Down

0 comments on commit 9cf43de

Please sign in to comment.