Skip to content

Commit

Permalink
Fix for 2021.12b0 or later
Browse files Browse the repository at this point in the history
  • Loading branch information
Crazysiri committed Apr 13, 2022
1 parent 7d643c5 commit b470f20
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion holiday.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"update_time": "2021-08-03", "2021": {"0801": 1, "0807": 1, "0808": 1, "0814": 1, "0815": 1, "0821": 1, "0822": 1, "0828": 1, "0829": 1, "0904": 1, "0905": 1, "0911": 1, "0912": 1, "0918": 0, "0919": 1, "0920": 1, "0921": 2, "0925": 1, "0926": 0, "1001": 2, "1002": 2, "1003": 2, "1004": 1, "1005": 1, "1006": 1, "1007": 1, "1009": 0, "1010": 1, "1016": 1, "1017": 1, "1023": 1, "1024": 1, "1030": 1, "1031": 1, "1106": 1, "1107": 1, "1113": 1, "1114": 1, "1120": 1, "1121": 1, "1127": 1, "1128": 1, "1204": 1, "1205": 1, "1211": 1, "1212": 1, "1218": 1, "1219": 1, "1225": 1, "1226": 1}, "2022": {"0101": 1, "0102": 1, "0108": 1, "0109": 1, "0115": 1, "0116": 1, "0122": 1, "0123": 1, "0129": 1, "0130": 1}}
{"update_time": "2022-04-13", "2022": {"0402": 0, "0403": 1, "0404": 1, "0405": 2, "0409": 1, "0410": 1, "0416": 1, "0417": 1, "0423": 1, "0424": 0, "0430": 1, "0501": 2, "0502": 1, "0503": 1, "0504": 1, "0507": 0, "0508": 1, "0514": 1, "0515": 1, "0521": 1, "0522": 1, "0528": 1, "0529": 1, "0603": 2, "0604": 1, "0605": 1, "0611": 1, "0612": 1, "0618": 1, "0619": 1, "0625": 1, "0626": 1, "0702": 1, "0703": 1, "0709": 1, "0710": 1, "0716": 1, "0717": 1, "0723": 1, "0724": 1, "0730": 1, "0731": 1, "0806": 1, "0807": 1, "0813": 1, "0814": 1, "0820": 1, "0821": 1, "0827": 1, "0828": 1, "0903": 1, "0904": 1, "0910": 2, "0911": 1, "0912": 1, "0917": 1, "0918": 1, "0924": 1, "0925": 1}}
6 changes: 6 additions & 0 deletions sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ def icon(self):
# def state_attributes(self):
# return self.attributes

@property
def extra_state_attributes(self):
"""Return the state attributes. for new version like 2022:4.3"""
return self.localizedAttributes

@property
def device_state_attributes(self):
"""Return the state attributes."""
Expand Down Expand Up @@ -487,6 +492,7 @@ def nearest_holiday(self):
return nearest_holiday_dict

def _update(self):
_LOGGER.info('update ...')
self.attributes = {} #重置attributes
self._lunar = lunar.CalendarToday()#重新赋值

Expand Down

0 comments on commit b470f20

Please sign in to comment.