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

Task due date Unknown #32

Closed
4 tasks done
e-estrange opened this issue Oct 15, 2023 · 10 comments · Fixed by #40
Closed
4 tasks done

Task due date Unknown #32

e-estrange opened this issue Oct 15, 2023 · 10 comments · Fixed by #40

Comments

@e-estrange
Copy link

System Health details

System Information

version core-2023.9.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.5
os_name Linux
os_version 6.1.45
arch x86_64
timezone Europe/Amsterdam
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.31.0
Stage running
Available Repositories 1372
Downloaded Repositories 13
HACS Data ok
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 10.5
update_channel stable
supervisor_version supervisor-2023.10.0
agent_version 1.5.1
docker_version 23.0.6
disk_total 30.8 GB
disk_used 12.0 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons Samba share (10.0.2), Terminal & SSH (9.7.1), File editor (5.6.0), Studio Code Server (5.11.0)
Dashboards
dashboards 2
resources 12
views 10
mode storage
Recorder
oldest_recorder_run September 30, 2023 at 20:04
current_recorder_run September 30, 2023 at 22:04
estimated_db_size 615.32 MiB
database_engine sqlite
database_version 3.41.2

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

Depending on the settings of the chore, the next due date is not always calculated. The only one where I am certain that it is calculated after completing it is when the interval is set to Every/After x days.
When selecting the weekly/monthly/yearly sometimes it will have next date 'unknown' right from the start. Other times it goes to 'unknow' after completing the task for the first time.

Reproduction steps

  1. Go to Settings > Devices and Services > Helpers
  2. Click on Create Helper > Chore
  3. Enter a name and set the frequency to 'every x weeks'. Leave other settings as is. Click on submit.
  4. On the second page, leave the default settings as is. It will now be due every 1 week. Click on submit.
  5. Look for the chore in the helper list. Click on the chore. Look at the attributes. The next due date is set to Unknown. This is the issue.
    image

Debug logs

2023-10-15 16:38:02.837 DEBUG (MainThread) [custom_components.tplink_deco.api] List devices device_count=2
2023-10-15 16:38:02.837 DEBUG (MainThread) [custom_components.tplink_deco.api] List devices device_list=[{'nand_flash': False, 'hardware_ver': '1.0', 'bssid_sta_2g': '', 'software_ver': '1.7.3 Build 20230906 Rel. 59213', 'role': 'master', 'bssid_sta_5g': '', 'previous': '', 'inet_status': 'online', 'nickname': 'Living Room', 'oversized_firmware': False, 'bssid_5g': 'BA:BE:76:E7:78:03', 'set_gateway_support': True, 'inet_error_msg': 'well', 'group_status': 'connected', 'mac': 'B0-BE-76-E7-78-00', 'bssid_2g': 'BA:BE:76:E7:78:02', 'support_plc': False, 'oem_id': 'cd709d3a3aab286a64e7b0ee898853c6', 'signal_level': {'band5': '0', 'band2_4': '0'}, 'product_level': 200, 'device_ip': '192.168.178.49', 'device_model': 'M5', 'hw_id': '55d528057d051dc37ad6b5defe854c48', 'device_type': 'HOMEWIFISYSTEM'}, {'nand_flash': False, 'owner_transfer': True, 'device_ip': '192.168.178.61', 'previous': 'B0-BE-76-E7-78-00', 'software_ver': '1.7.3 Build 20230906 Rel. 59213', 'parent_device_id': '8019F5C73C6BC95FC501AF96396AB4C21B36F06A', 'bssid_sta_2g': 'BA:BE:76:E7:78:02', 'bssid_2g': '10:27:F5:50:10:7A', 'role': 'slave', 'bssid_sta_5g': 'BA:BE:76:E7:78:03', 'speed_get_support': True, 'device_id': '80198BE178740792225ED3B3E3AC8AA51ECA0F8C', 'product_level': 200, 'inet_status': 'online', 'nickname': 'Hallway', 'bssid_5g': '10:27:F5:50:10:7B', 'mac': '10-27-F5-50-10-78', 'set_gateway_support': True, 'inet_error_msg': 'well', 'connection_type': ['band2_4', 'band5'], 'hardware_ver': '3.2', 'support_plc': False, 'group_status': 'connected', 'oem_id': 'cd709d3a3aab286a64e7b0ee898853c6', 'signal_level': {'band2_4': '2', 'band5': '1'}, 'device_model': 'M5', 'oversized_firmware': False, 'topology': {'auto': True, 'device_id': ''}, 'hw_id': '55d528057d051dc37ad6b5defe854c48', 'device_type': 'HOMEWIFISYSTEM'}]
2023-10-15 16:38:02.837 DEBUG (MainThread) [custom_components.tplink_deco.coordinator] Finished fetching tplink_deco-decos data in 3.857 seconds (success: True)
2023-10-15 16:38:02.861 DEBUG (MainThread) [homewizard_energy.homewizard_energy] GET, http://192.168.178.59/api, None
2023-10-15 16:38:02.912 DEBUG (MainThread) [homewizard_energy.homewizard_energy] 200, {"product_type":"HWE-WTR","product_name":"Watermeter","serial":"5c2faf06bce0","firmware_version":"2.03","api_version":"v1"}
2023-10-15 16:38:02.913 DEBUG (MainThread) [homewizard_energy.homewizard_energy] GET, http://192.168.178.59/api/v1/data, None
2023-10-15 16:38:02.938 DEBUG (MainThread) [homewizard_energy.homewizard_energy] GET, http://192.168.178.57/api, None
2023-10-15 16:38:02.959 DEBUG (MainThread) [homewizard_energy.homewizard_energy] 200, {"product_type":"HWE-SKT","product_name":"Energy Socket","serial":"3c39e7280602","firmware_version":"3.03","api_version":"v1"}
2023-10-15 16:38:02.960 DEBUG (MainThread) [homewizard_energy.homewizard_energy] GET, http://192.168.178.57/api/v1/data, None
2023-10-15 16:38:02.988 DEBUG (MainThread) [homewizard_energy.homewizard_energy] 200, {"wifi_ssid":"Veldbloempjes","wifi_strength":72,"total_liter_m3":50.497,"active_liter_lpm":0,"total_liter_offset_m3":0}
2023-10-15 16:38:02.989 DEBUG (MainThread) [homeassistant.components.homewizard.coordinator] Finished fetching homewizard data in 0.128 seconds (success: True)
2023-10-15 16:38:02.994 DEBUG (MainThread) [kasa.smartdevice] The device has emeter, querying its information along sysinfo
2023-10-15 16:38:02.994 DEBUG (MainThread) [kasa.smartdevice] Module emeter already registered, ignoring...
2023-10-15 16:38:02.994 DEBUG (MainThread) [kasa.smartdevice] Adding query for <Module Schedule (schedule) for 192.168.178.62>: {'schedule': {'get_rules': None, 'get_next_action': None}}
2023-10-15 16:38:02.994 DEBUG (MainThread) [kasa.smartdevice] Adding query for <Module Usage (schedule) for 192.168.178.62>: {'schedule': {'get_realtime': None, 'get_daystat': {'year': 2023, 'month': 10}, 'get_monthstat': {'year': 2023}}}
2023-10-15 16:38:02.994 DEBUG (MainThread) [kasa.smartdevice] Adding query for <Module Antitheft (anti_theft) for 192.168.178.62>: {'anti_theft': {'get_rules': None, 'get_next_action': None}}
2023-10-15 16:38:02.995 DEBUG (MainThread) [kasa.smartdevice] Adding query for <Module Time (time) for 192.168.178.62>: {'time': {'get_time': None, 'get_timezone': None}}
2023-10-15 16:38:02.995 DEBUG (MainThread) [kasa.smartdevice] Adding query for <Module Cloud (cnCloud) for 192.168.178.62>: {'cnCloud': {'get_info': None}}
2023-10-15 16:38:02.995 DEBUG (MainThread) [kasa.smartdevice] Adding query for <Module Emeter (emeter) for 192.168.178.62>: {'emeter': {'get_realtime': None, 'get_daystat': {'year': 2023, 'month': 10}, 'get_monthstat': {'year': 2023}}}
2023-10-15 16:38:02.995 DEBUG (MainThread) [kasa.protocol] 192.168.178.62 >> {"system":{"get_sysinfo":null},"schedule":{"get_rules":null,"get_next_action":null,"get_realtime":null,"get_daystat":{"year":2023,"month":10},"get_monthstat":{"year":2023}},"anti_theft":{"get_rules":null,"get_next_action":null},"time":{"get_time":null,"get_timezone":null},"cnCloud":{"get_info":null},"emeter":{"get_realtime":null,"get_daystat":{"year":2023,"month":10},"get_monthstat":{"year":2023}}}
2023-10-15 16:38:02.996 DEBUG (MainThread) [kasa.protocol] Unable to query the device 192.168.178.62, retrying: 0 bytes read on a total of 4 expected bytes
2023-10-15 16:38:03.008 DEBUG (MainThread) [kasa.protocol] 192.168.178.62 >> {"system":{"get_sysinfo":null},"schedule":{"get_rules":null,"get_next_action":null,"get_realtime":null,"get_daystat":{"year":2023,"month":10},"get_monthstat":{"year":2023}},"anti_theft":{"get_rules":null,"get_next_action":null},"time":{"get_time":null,"get_timezone":null},"cnCloud":{"get_info":null},"emeter":{"get_realtime":null,"get_daystat":{"year":2023,"month":10},"get_monthstat":{"year":2023}}}
2023-10-15 16:38:03.042 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139972300367040] admin from 192.168.178.65 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0): Received {'type': 'config/entity_registry/get', 'entity_id': 'sensor.test_chore', 'id': 162}
2023-10-15 16:38:03.043 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139972300367040] admin from 192.168.178.65 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0): Sending {"id":162,"type":"result","success":true,"result":{"area_id":null,"config_entry_id":"b35be3ed44320858b19f3d5ad2bddf34","device_id":null,"disabled_by":null,"entity_category":null,"entity_id":"sensor.test_chore","has_entity_name":false,"hidden_by":null,"icon":null,"id":"5876affce35a5abf8008b9d2f76c2178","name":null,"options":{"conversation":{"should_expose":false}},"original_name":"test chore","platform":"chore_helper","translation_key":null,"unique_id":"b35be3ed44320858b19f3d5ad2bddf34","aliases":[],"capabilities":null,"device_class":null,"original_device_class":null,"original_icon":"mdi:broom"}}
2023-10-15 16:38:03.047 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: CommitTask()
2023-10-15 16:38:03.048 DEBUG (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7f4de4be53f0> checked out from pool
2023-10-15 16:38:03.055 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139972300367040] admin from 192.168.178.65 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0): Received {'type': 'history/stream', 'entity_ids': ['sensor.test_chore'], 'start_time': '2023-10-14T14:38:03.206Z', 'minimal_response': True, 'significant_changes_only': True, 'no_attributes': True, 'id': 163}
2023-10-15 16:38:03.056 DEBUG (MainThread) [homewizard_energy.homewizard_energy] 200, {"wifi_ssid":"Veldbloempjes","wifi_strength":54,"total_power_import_t1_kwh":269.324,"total_power_export_t1_kwh":0,"active_power_w":22.889,"active_power_l1_w":22.889}
2023-10-15 16:38:03.056 DEBUG (MainThread) [homewizard_energy.homewizard_energy] GET, http://192.168.178.57/api/v1/state, None
2023-10-15 16:38:03.071 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139972300367040] admin from 192.168.178.65 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0): Sending {"id":163,"type":"result","success":true,"result":null}
2023-10-15 16:38:03.090 DEBUG (DbWorker_0) [homeassistant.components.recorder.pool.RecorderPool] Created new connection <sqlite3.Connection object at 0x7f4de7dd95d0>
2023-10-15 16:38:03.112 DEBUG (MainThread) [kasa.protocol] 192.168.178.62 << {'anti_theft': {'get_next_action': {'err_code': -2,
                                    'err_msg': 'member not support'},
                'get_rules': {'enable': 0, 'err_code': 0, 'rule_list': []}},
 'cnCloud': {'get_info': {'binded': 1,
                          'cld_connection': 1,
                          'err_code': 0,
                          'fwDlPage': '',
                          'fwNotifyType': 0,
                          'illegalType': 0,
                          'server': 'n-devs.tplinkcloud.com',
                          'stopConnect': 0,
                          'tcspInfo': '',
                          'tcspStatus': 1,
                          'username': '[email protected]'}},
 'emeter': {'get_daystat': {'day_list': [{'day': 1,
                                          'energy': 0.057,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 2,
                                          'energy': 0.057,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 3,
                                          'energy': 0.057,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 4,
                                          'energy': 0.057,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 5,
                                          'energy': 0.056,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 6,
                                          'energy': 0.057,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 7,
                                          'energy': 0.056,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 8,
                                          'energy': 0.056,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 9,
                                          'energy': 0.056,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 10,
                                          'energy': 0.057,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 11,
                                          'energy': 0.056,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 12,
                                          'energy': 0.056,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 13,
                                          'energy': 0.056,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 14,
                                          'energy': 0.057,
                                          'month': 10,
                                          'year': 2023},
                                         {'day': 15,
                                          'energy': 0.039,
                                          'month': 10,
                                          'year': 2023}],
                            'err_code': 0},
            'get_monthstat': {'err_code': 0,
                              'month_list': [{'energy': 2.635,
                                              'month': 1,
                                              'year': 2023},
                                             {'energy': 2.272,
                                              'month': 2,
                                              'year': 2023},
                                             {'energy': 2.348,
                                              'month': 3,
                                              'year': 2023},
                                             {'energy': 2.274,
                                              'month': 4,
                                              'year': 2023},
                                             {'energy': 2.363,
                                              'month': 5,
                                              'year': 2023},
                                             {'energy': 2.306,
                                              'month': 6,
                                              'year': 2023},
                                             {'energy': 2.384,
                                              'month': 7,
                                              'year': 2023},
                                             {'energy': 2.387,
                                              'month': 8,
                                              'year': 2023},
                                             {'energy': 1.862,
                                              'month': 9,
                                              'year': 2023},
                                             {'energy': 0.83,
                                              'month': 10,
                                              'year': 2023}]},
            'get_realtime': {'current': 0.02409,
                             'err_code': 0,
                             'power': 2.374956,
                             'total': 39.455,
                             'voltage': 235.671034}},
 'schedule': {'get_daystat': {'day_list': [{'day': 1,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 2,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 3,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 4,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 5,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 6,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 7,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 8,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 9,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 10,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 11,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 12,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 13,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 14,
                                            'month': 10,
                                            'time': 1440,
                                            'year': 2023},
                                           {'day': 15,
                                            'month': 10,
                                            'time': 998,
                                            'year': 2023}],
                              'err_code': 0},
              'get_monthstat': {'err_code': 0,
                                'month_list': [{'month': 1,
                                                'time': 44640,
                                                'year': 2023},
                                               {'month': 2,
                                                'time': 40319,
                                                'year': 2023},
                                               {'month': 3,
                                                'time': 44580,
                                                'year': 2023},
                                               {'month': 4,
                                                'time': 43200,
                                                'year': 2023},
                                               {'month': 5,
                                                'time': 44640,
                                                'year': 2023},
                                               {'month': 6,
                                                'time': 43199,
                                                'year': 2023},
                                               {'month': 7,
                                                'time': 44640,
                                                'year': 2023},
                                               {'month': 8,
                                                'time': 44640,
                                                'year': 2023},
                                               {'month': 9,
                                                'time': 43199,
                                                'year': 2023},
                                               {'month': 10,
                                                'time': 21158,
                                                'year': 2023}]},
              'get_next_action': {'err_code': 0, 'type': -1},
              'get_realtime': {'err_code': -2, 'err_msg': 'member not support'},
              'get_rules': {'enable': 1, 'err_code': 0, 'rule_list': []}},
 'system': {'get_sysinfo': {'active_mode': 'schedule',
                            'alias': 'Helium miner',
                            'dev_name': 'Wi-Fi Smart Plug With Energy '
                                        'Monitoring',
                            'deviceId': '8006AF3AF905A66FB52B681A87ECB420193F0323',
                            'err_code': 0,
                            'feature': 'TIM:ENE',
                            'fwId': '00000000000000000000000000000000',
                            'hwId': '45E29DA8382494D2E82688B52A0B2EB5',
                            'hw_ver': '1.0',
                            'icon_hash': '',
                            'latitude': 0,
                            'led_off': 0,
                            'longitude': 0,
                            'mac': '70:4F:57:A3:B9:E5',
                            'model': 'HS110(EU)',
                            'oemId': '3D341ECE302C0642C99E31CE2430544B',
                            'on_time': 42511184,
                            'relay_state': 1,
                            'rssi': -56,
                            'sw_ver': '1.2.6 Build 200727 Rel.120821',
                            'type': 'IOT.SMARTPLUGSWITCH',
                            'updating': 0}},
 'time': {'get_time': {'err_code': 0,
                       'hour': 16,
                       'mday': 15,
                       'min': 38,
                       'month': 10,
                       'sec': 2,
                       'wday': 0,
                       'year': 2023},
          'get_timezone': {'dst_offset': 60,
                           'err_code': 0,
                           'index': 41,
                           'tz_str': 'CET-1CEST,M3.5.0,M10.5.0/3',
                           'zone_str': '(UTC+01:00) Amsterdam, Berlin, Bern, '
                                       'Rome, Stockholm, Vienna'}}}
2023-10-15 16:38:03.113 DEBUG (MainThread) [homeassistant.components.tplink.coordinator] Finished fetching 192.168.178.62 data in 0.119 seconds (success: True)
2023-10-15 16:38:03.113 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.helium_miner_current_consumption, old_state=<state sensor.helium_miner_current_consumption=2.3; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Helium miner Current consumption @ 2023-10-15T16:37:58.165406+02:00>, new_state=<state sensor.helium_miner_current_consumption=2.4; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Helium miner Current consumption @ 2023-10-15T16:38:03.113813+02:00>>
2023-10-15 16:38:03.115 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.helium_miner_voltage, old_state=<state sensor.helium_miner_voltage=235.5; state_class=measurement, unit_of_measurement=V, device_class=voltage, friendly_name=Helium miner Voltage @ 2023-10-15T16:37:58.167181+02:00>, new_state=<state sensor.helium_miner_voltage=235.7; state_class=measurement, unit_of_measurement=V, device_class=voltage, friendly_name=Helium miner Voltage @ 2023-10-15T16:38:03.115035+02:00>>
2023-10-15 16:38:03.122 DEBUG (DbWorker_0) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7f4de7dd95d0> checked out from pool
2023-10-15 16:38:03.141 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139972300367040] admin from 192.168.178.65 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0): Sending [{"id":2,"type":"event","event":{"c":{"sensor.helium_miner_current_consumption":{"+":{"s":"2.4","lc":1697380683.113813,"c":"01HCSWBKB93WDT0D0PXAM6FRJK"}}}}},{"id":2,"type":"event","event":{"c":{"sensor.helium_miner_voltage":{"+":{"s":"235.7","lc":1697380683.115035,"c":"01HCSWBKBBWTVBXH5978MGEAMR"}}}}}]
2023-10-15 16:38:03.157 DEBUG (MainThread) [homeassistant.helpers.event] Template update {%- set ns = namespace(sensors=[]) -%} {%- for state in states.sensor 
  | selectattr('attributes.icon', 'defined')
  | selectattr('attributes.icon', '==', 'mdi:wifi') -%}
  {%- if state.state == "Veldbloempjes" and 'Phone' in state.attributes.friendly_name -%}
    {% set truncated_name = state.name | regex_replace('Phone.*', 'Phone') %}
    {% set ns.sensors = ns.sensors + [dict(name = truncated_name, state = state.state)] %}
  {%- endif -%}
{%- endfor -%} {%- set batt = ns.sensors | sort(attribute='state') %} {%- set ns = namespace(batt='') -%} {%- for state in batt -%}
    {% set ns.batt= ns.batt + (state.name ~ "\n") %}
{%- endfor -%}
{% if ns.batt | count > 0 %}
  {{ ns.batt | truncate(255, true, '...') }}
{% else %}
  {{ 'unavailable' }}
{% endif %} triggered by event: <Event state_changed[L]: entity_id=sensor.helium_miner_current_consumption, old_state=<state sensor.helium_miner_current_consumption=2.3; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Helium miner Current consumption @ 2023-10-15T16:37:58.165406+02:00>, new_state=<state sensor.helium_miner_current_consumption=2.4; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Helium miner Current consumption @ 2023-10-15T16:38:03.113813+02:00>>
2023-10-15 16:38:03.173 DEBUG (MainThread) [homeassistant.helpers.event] Template group [TrackTemplate(template=Template<template=({%- set ns = namespace(sensors=[]) -%} {%- for state in states.sensor 
  | selectattr('attributes.icon', 'defined')
  | selectattr('attributes.icon', '==', 'mdi:wifi') -%}
  {%- if state.state == "Veldbloempjes" and 'Phone' in state.attributes.friendly_name -%}
    {% set truncated_name = state.name | regex_replace('Phone.*', 'Phone') %}
    {% set ns.sensors = ns.sensors + [dict(name = truncated_name, state = state.state)] %}
  {%- endif -%}
{%- endfor -%} {%- set batt = ns.sensors | sort(attribute='state') %} {%- set ns = namespace(batt='') -%} {%- for state in batt -%}
    {% set ns.batt= ns.batt + (state.name ~ "\n") %}
{%- endfor -%}
{% if ns.batt | count > 0 %}
  {{ ns.batt | truncate(255, true, '...') }}
{% else %}
  {{ 'unavailable' }}
{% endif %}) renders=66>, variables={'this': <template TemplateStateFromEntityId(sensor.precense_detector)>}, rate_limit=None)] listens for {'all': False, 'entities': set(), 'domains': {'sensor'}, 'time': False}, re-render blocked by super template: False
2023-10-15 16:38:03.174 DEBUG (MainThread) [homeassistant.helpers.event] Template update {% set threshold = states('input_number.battery_threshold') | int %} {%- set ns = namespace(sensors=[]) -%} {%- for state in states.sensor 
  | selectattr('attributes.device_class', 'defined')
  | selectattr('attributes.device_class', '==', 'battery') 
  | selectattr('state', 'is_number') -%}
  {%- if state.state | int <= threshold -%}
    {% set ns.sensors = ns.sensors + [dict(name = state.name | replace(' battery', '') | replace(' Battery', ''), state = state.state | int)] %}
  {%- endif -%}
{%- endfor -%} {%- set batt = ns.sensors | sort(attribute='state') %} {%- set ns = namespace(batt='') -%} {%- for state in batt -%}
    {% set ns.batt= ns.batt + (state.name  ~ ' (' ~ state.state ~'%)' ~ "\n") %}
{%- endfor -%}
{% if ns.batt | count > 0 %}
  {{ ns.batt | truncate(255, true, '...') }}
{% else %}
  {{ 'none' }}
{% endif %} triggered by event: <Event state_changed[L]: entity_id=sensor.helium_miner_current_consumption, old_state=<state sensor.helium_miner_current_consumption=2.3; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Helium miner Current consumption @ 2023-10-15T16:37:58.165406+02:00>, new_state=<state sensor.helium_miner_current_consumption=2.4; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Helium miner Current consumption @ 2023-10-15T16:38:03.113813+02:00>>
2023-10-15 16:38:03.192 DEBUG (MainThread) [homeassistant.helpers.event] Template update mdi:battery-low triggered by event: <Event state_changed[L]: entity_id=sensor.helium_miner_current_consumption, old_state=<state sensor.helium_miner_current_consumption=2.3; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Helium miner Current consumption @ 2023-10-15T16:37:58.165406+02:00>, new_state=<state sensor.helium_miner_current_consumption=2.4; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Helium miner Current consumption @ 2023-10-15T16:38:03.113813+02:00>>
2023-10-15 16:38:03.193 DEBUG (MainThread) [homeassistant.helpers.event] Template group [TrackTemplate(template=Template<template=({% set threshold = states('input_number.battery_threshold') | int %} {%- set ns = namespace(sensors=[]) -%} {%- for state in states.sensor 
  | selectattr('attributes.device_class', 'defined')
  | selectattr('attributes.device_class', '==', 'battery') 
  | selectattr('state', 'is_number') -%}
  {%- if state.state | int <= threshold -%}
    {% set ns.sensors = ns.sensors + [dict(name = state.name | replace(' battery', '') | replace(' Battery', ''), state = state.state | int)] %}
  {%- endif -%}
{%- endfor -%} {%- set batt = ns.sensors | sort(attribute='state') %} {%- set ns = namespace(batt='') -%} {%- for state in batt -%}
    {% set ns.batt= ns.batt + (state.name  ~ ' (' ~ state.state ~'%)' ~ "\n") %}
{%- endfor -%}
{% if ns.batt | count > 0 %}
  {{ ns.batt | truncate(255, true, '...') }}
{% else %}
  {{ 'none' }}
{% endif %}) renders=66>, variables={'this': <template TemplateStateFromEntityId(sensor.low_battery_devices_2)>}, rate_limit=None), TrackTemplate(template=Template<template=(mdi:battery-low) renders=34>, variables={'this': <template TemplateStateFromEntityId(sensor.low_battery_devices_2)>}, rate_limit=None)] listens for {'all': False, 'entities': {'input_number.battery_threshold'}, 'domains': {'sensor'}, 'time': False}, re-render blocked by super template: False
2023-10-15 16:38:03.193 DEBUG (MainThread) [homeassistant.helpers.ratelimit] Reached rate limit of 0:00:01 for Template<template=({%- set ns = namespace(sensors=[]) -%} {%- for state in states.sensor 
  | selectattr('attributes.icon', 'defined')
  | selectattr('attributes.icon', '==', 'mdi:wifi') -%}
  {%- if state.state == "Veldbloempjes" and 'Phone' in state.attributes.friendly_name -%}
    {% set truncated_name = state.name | regex_replace('Phone.*', 'Phone') %}
    {% set ns.sensors = ns.sensors + [dict(name = truncated_name, state = state.state)] %}
  {%- endif -%}
{%- endfor -%} {%- set batt = ns.sensors | sort(attribute='state') %} {%- set ns = namespace(batt='') -%} {%- for state in batt -%}
    {% set ns.batt= ns.batt + (state.name ~ "\n") %}
{%- endfor -%}
{% if ns.batt | count > 0 %}
  {{ ns.batt | truncate(255, true, '...') }}
{% else %}
  {{ 'unavailable' }}
{% endif %}) renders=66> and deferred action until 2023-10-15 14:38:04.113813+00:00
2023-10-15 16:38:03.201 DEBUG (MainThread) [homeassistant.helpers.event] Template group [TrackTemplate(template=Template<template=({%- set ns = namespace(sensors=[]) -%} {%- for state in states.sensor 
  | selectattr('attributes.icon', 'defined')
  | selectattr('attributes.icon', '==', 'mdi:wifi') -%}
  {%- if state.state == "Veldbloempjes" and 'Phone' in state.attributes.friendly_name -%}
    {% set truncated_name = state.name | regex_replace('Phone.*', 'Phone') %}
    {% set ns.sensors = ns.sensors + [dict(name = truncated_name, state = state.state)] %}
  {%- endif -%}
{%- endfor -%} {%- set batt = ns.sensors | sort(attribute='state') %} {%- set ns = namespace(batt='') -%} {%- for state in batt -%}
    {% set ns.batt= ns.batt + (state.name ~ "\n") %}
{%- endfor -%}
{% if ns.batt | count > 0 %}
  {{ ns.batt | truncate(255, true, '...') }}
{% else %}
  {{ 'unavailable' }}
{% endif %}) renders=66>, variables={'this': <template TemplateStateFromEntityId(sensor.precense_detector)>}, rate_limit=None)] listens for {'all': False, 'entities': set(), 'domains': set(), 'time': False}, re-render blocked by super template: False
2023-10-15 16:38:03.202 DEBUG (MainThread) [homeassistant.helpers.ratelimit] Reached rate limit of 0:00:01 for Template<template=({% set threshold = states('input_number.battery_threshold') | int %} {%- set ns = namespace(sensors=[]) -%} {%- for state in states.sensor 
  | selectattr('attributes.device_class', 'defined')
  | selectattr('attributes.device_class', '==', 'battery') 
  | selectattr('state', 'is_number') -%}
  {%- if state.state | int <= threshold -%}
    {% set ns.sensors = ns.sensors + [dict(name = state.name | replace(' battery', '') | replace(' Battery', ''), state = state.state | int)] %}
  {%- endif -%}
{%- endfor -%} {%- set batt = ns.sensors | sort(attribute='state') %} {%- set ns = namespace(batt='') -%} {%- for state in batt -%}
    {% set ns.batt= ns.batt + (state.name  ~ ' (' ~ state.state ~'%)' ~ "\n") %}
{%- endfor -%}
{% if ns.batt | count > 0 %}
  {{ ns.batt | truncate(255, true, '...') }}
{% else %}
  {{ 'none' }}
{% endif %}) renders=66> and deferred action until 2023-10-15 14:38:04.113813+00:00
2023-10-15 16:38:03.202 DEBUG (MainThread) [homeassistant.helpers.event] Template update mdi:battery-low triggered by event: <Event state_changed[L]: entity_id=sensor.helium_miner_voltage, old_state=<state sensor.helium_miner_voltage=235.5; state_class=measurement, unit_of_measurement=V, device_class=voltage, friendly_name=Helium miner Voltage @ 2023-10-15T16:37:58.167181+02:00>, new_state=<state sensor.helium_miner_voltage=235.7; state_class=measurement, unit_of_measurement=V, device_class=voltage, friendly_name=Helium miner Voltage @ 2023-10-15T16:38:03.115035+02:00>>
2023-10-15 16:38:03.203 DEBUG (MainThread) [homeassistant.helpers.event] Template group [TrackTemplate(template=Template<template=({% set threshold = states('input_number.battery_threshold') | int %} {%- set ns = namespace(sensors=[]) -%} {%- for state in states.sensor 
  | selectattr('attributes.device_class', 'defined')
  | selectattr('attributes.device_class', '==', 'battery') 
  | selectattr('state', 'is_number') -%}
  {%- if state.state | int <= threshold -%}
    {% set ns.sensors = ns.sensors + [dict(name = state.name | replace(' battery', '') | replace(' Battery', ''), state = state.state | int)] %}
  {%- endif -%}
{%- endfor -%} {%- set batt = ns.sensors | sort(attribute='state') %} {%- set ns = namespace(batt='') -%} {%- for state in batt -%}
    {% set ns.batt= ns.batt + (state.name  ~ ' (' ~ state.state ~'%)' ~ "\n") %}
{%- endfor -%}
{% if ns.batt | count > 0 %}
  {{ ns.batt | truncate(255, true, '...') }}
{% else %}
  {{ 'none' }}
{% endif %}) renders=66>, variables={'this': <template TemplateStateFromEntityId(sensor.low_battery_devices_2)>}, rate_limit=None), TrackTemplate(template=Template<template=(mdi:battery-low) renders=35>, variables={'this': <template TemplateStateFromEntityId(sensor.low_battery_devices_2)>}, rate_limit=None)] listens for {'all': False, 'entities': {'input_number.battery_threshold'}, 'domains': set(), 'time': False}, re-render blocked by super template: False
2023-10-15 16:38:03.209 DEBUG (DbWorker_0) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7f4de7dd95d0> being returned to pool
2023-10-15 16:38:03.210 DEBUG (DbWorker_0) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7f4de7dd95d0> rollback-on-return
2023-10-15 16:38:03.213 DEBUG (MainThread) [homewizard_energy.homewizard_energy] 200, {"power_on":true,"switch_lock":false,"brightness":0}
2023-10-15 16:38:03.214 DEBUG (MainThread) [homewizard_energy.homewizard_energy] GET, http://192.168.178.57/api/v1/system, None
2023-10-15 16:38:03.220 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139972300367040] admin from 192.168.178.65 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0): Sending {"id":163,"type":"event","event":{"states":{"sensor.test_chore":[{"s":"unknown","lu":1697380675.772231}]},"start_time":1697294283.206,"end_time":1697380675.772231}}
2023-10-15 16:38:03.236 DEBUG (MainThread) [homewizard_energy.homewizard_energy] 200, {"cloud_enabled":true}
2023-10-15 16:38:03.237 DEBUG (MainThread) [homeassistant.components.homewizard.coordinator] Finished fetching homewizard data in 0.298 seconds (success: True)
2023-10-15 16:38:03.238 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.energy_socket_3c39e7280602_active_power, old_state=<state sensor.energy_socket_3c39e7280602_active_power=25.233; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Energy Socket (NAS) Active power @ 2023-10-15T16:37:58.238553+02:00>, new_state=<state sensor.energy_socket_3c39e7280602_active_power=22.889; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Energy Socket (NAS) Active power @ 2023-10-15T16:38:03.237930+02:00>>
2023-10-15 16:38:03.238 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.energy_socket_3c39e7280602_active_power_phase_1, old_state=<state sensor.energy_socket_3c39e7280602_active_power_phase_1=25.233; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Energy Socket (NAS) Active power phase 1 @ 2023-10-15T16:37:58.239761+02:00>, new_state=<state sensor.energy_socket_3c39e7280602_active_power_phase_1=22.889; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Energy Socket (NAS) Active power phase 1 @ 2023-10-15T16:38:03.238810+02:00>>
2023-10-15 16:38:03.239 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139972300367040] admin from 192.168.178.65 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0): Sending [{"id":2,"type":"event","event":{"c":{"sensor.energy_socket_3c39e7280602_active_power":{"+":{"s":"22.889","lc":1697380683.23793,"c":"01HCSWBKF5MC39MVJDMEAJSFSV"}}}}},{"id":2,"type":"event","event":{"c":{"sensor.energy_socket_3c39e7280602_active_power_phase_1":{"+":{"s":"22.889","lc":1697380683.23881,"c":"01HCSWBKF65EHR2RNA1NY06KFC"}}}}}]
2023-10-15 16:38:03.526 DEBUG (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7f4de4be53f0> being returned to pool
2023-10-15 16:38:03.526 DEBUG (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7f4de4be53f0> rollback-on-return
2023-10-15 16:38:03.526 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: EventTask(event=<Event state_changed[L]: entity_id=sensor.helium_miner_current_consumption, old_state=<state sensor.helium_miner_current_consumption=2.3; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Helium miner Current consumption @ 2023-10-15T16:37:58.165406+02:00>, new_state=<state sensor.helium_miner_current_consumption=2.4; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Helium miner Current consumption @ 2023-10-15T16:38:03.113813+02:00>>)
2023-10-15 16:38:03.528 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: EventTask(event=<Event state_changed[L]: entity_id=sensor.helium_miner_voltage, old_state=<state sensor.helium_miner_voltage=235.5; state_class=measurement, unit_of_measurement=V, device_class=voltage, friendly_name=Helium miner Voltage @ 2023-10-15T16:37:58.167181+02:00>, new_state=<state sensor.helium_miner_voltage=235.7; state_class=measurement, unit_of_measurement=V, device_class=voltage, friendly_name=Helium miner Voltage @ 2023-10-15T16:38:03.115035+02:00>>)
2023-10-15 16:38:03.529 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: SynchronizeTask(event=<asyncio.locks.Event object at 0x7f4dc9a73d90 [unset, waiters:1]>)
2023-10-15 16:38:03.532 DEBUG (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7f4de4be53f0> checked out from pool
2023-10-15 16:38:03.539 DEBUG (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7f4de4be53f0> being returned to pool
2023-10-15 16:38:03.539 DEBUG (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Connection <sqlite3.Connection object at 0x7f4de4be53f0> rollback-on-return

Diagnostics dump

N/A

@Sceptorrh
Copy link

Same issue for me, Trying to create a weekly after chore. (For aquarium waterchanges). Sensor state is Unkown. I tried to update the chore with a service action but sadly without result. The integration seems amazing but sadly not usable for me in this state =(

@Sono-Gomorrha
Copy link

Sono-Gomorrha commented Jan 16, 2024

I have the same issue with a chore that should be due 6 months after doing it (de-icing the freezer). But when setting the cycle to after 2 days it works fine and shows next due date to be in two days.

Hardly ideal, but maybe this gives you some sort of functionality.

@bmcclure
Copy link
Owner

Thanks for the reports about this issue! It seems like there may be a bug somewhere in the due date calculation logic. I have about 30 chores in my system that are all calculating OK, and almost all of them are "after N" chores, so it seems like I must not be using the combination of settings that causes this error.

Could someone experiencing this possibly post a list of every setting on that bad chore, including the attributes such as the start date and the last completed date? A screenshot would be fine too.

Thank you!

@Sono-Gomorrha
Copy link

Sono-Gomorrha commented Jan 23, 2024

Hello, here are some screenshots of a test config.

Newly created chore
SCR-20240123-fwb

Chore config
SCR-20240123-fwj

SCR-20240123-fwm

Button card to complete the chore
SCR-20240123-fx4

Button card as code:

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: chore_helper.complete
  target:
    entity_id: sensor.this_is_a_test
  data: {}
entity: sensor.this_is_a_test

After clicking the button this is the result:

SCR-20240123-fy8

To me it looks like the issue might be the days are not added. I created a similar after 6 monhts chore by creating one which shall be done after 180 days. This chore works fine and I can see the days reducing e.g. now it is at 173 days.

@webmediart-github
Copy link

webmediart-github commented Jan 23, 2024

I would like to add to this, as I am facing the same bug. From the created chores I noticed, that one of them (the one with the dog as an icon):
image

is missing from the list of available entities for the chore services, e.g.:
image


Updating an entity results in the same bug for me as described by others.
Calling the chore_helper.complete service, renders the completed entity's state as unknown. In contrast to the above issue, these entries are still listed as valid entities for service calls. However, even after calling the add_date service, it still shows as unknown.
image
image

@Sono-Gomorrha
Copy link

Hello, I have another addition: This morning I looked at my example again and now the due date is filled. Looking at the history of the entity we can see that the days where updated shortly after midnight on the 24th of January. In my screenshots above you can see that I completed the chore on the 23rd of January. So it looks like the calculation only happens at midnight.

Please note that this is not the case for daily chores. I completed a chore today which shall be done again after 2 days and the day counter was updated directly after completing the chore (aka calling the service)

image

@Socio241
Copy link

Any news or fixes in sight? I am having the same issue. I just created an "after 4 weeks" chore and its dates remain on UNKNOWN (even after 24 hours).

@Socio241
Copy link

I made an observation:
If I change the existing "after 4 weeks" chore to "after 4 days/months/years" it immediately updates correctly. Then changing it back to "after 4 weeks" the state goes back to UNKNOWN. So it seems like the calculation of the weeks is broken.

The rest of the chore looks like this:
Due every/after 4 weeks
Due day: None
First due week: 1
First due month: January
Last due month: December
Start date: Feb. 15th 2024 (tried different dates, but it did not make any difference).

@danhoeflinger
Copy link

I think #40 should fix the issue. Changing the code locally on my home assistant seems to resolve the issues I was having with "after N weeks".

@WhoDunDidIt
Copy link

I think #40 should fix the issue. Changing the code locally on my home assistant seems to resolve the issues I was having with "after N weeks".

I can confirm that this PR seems to fix the issue. I applied the changes, restarted HA and within a few seconds of HA fully booting, the chore sensors were updated with the appropriate values, no need to re-complete the chore!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants