jeroenterheerdt / HAsmartirrigation

Smart Irrigation custom component for Home Assistant
MIT License
308 stars 48 forks source link

smart_irrigation.reset_bucket doesn't reset duration #210

Closed gatonero closed 9 months ago

gatonero commented 9 months ago

What happened?

smart_irrigation.reset_bucket just resets the bucket but not duration.

How to reproduce

execute smart_irrigation.reset_bucket

Relevant log output

No response

Which version are you running?

v2023.8.0-beta27

Diagnostics file

Additional information

No response

jeroenterheerdt commented 9 months ago

let me know if beta 28 fixes it

gatonero commented 9 months ago

grafik

jeroenterheerdt commented 9 months ago

please remove all versions, reboot, install beta28

gatonero commented 9 months ago

removed, rebooted, activated "Show beta", see beta28, but its not taken to "Select version" grafik

gatonero commented 9 months ago

Ok now just have to update my browser cache

jeroenterheerdt commented 9 months ago

Ok now just have to update my browser cache

yep, browser cache was not invalidated yet.

gatonero commented 9 months ago

grafik

gatonero commented 9 months ago
This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/smart_irrigation/store.py:191
Integration: Smart Irrigation (documentation, issues)
First occurred: 00:31:23 (1 occurrences)
Last logged: 00:31:23

Error setting up entry Smart Irrigation for smart_irrigation
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/__init__.py", line 62, in async_setup_entry
    store = await async_get_registry(hass)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/store.py", line 524, in async_get_registry
    return cast(SmartIrrigationStorage, await task)
                                        ^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/store.py", line 519, in _load_reg
    await registry.async_load()
  File "/config/custom_components/smart_irrigation/store.py", line 191, in async_load
    maximum_duration = zone[ZONE_MAXIMUM_DURATION]
                       ~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'maximum_duration'
jeroenterheerdt commented 9 months ago
This error originated from a custom integration.

Logger: homeassistant.config_entries
Source: custom_components/smart_irrigation/store.py:191
Integration: Smart Irrigation (documentation, issues)
First occurred: 00:31:23 (1 occurrences)
Last logged: 00:31:23

Error setting up entry Smart Irrigation for smart_irrigation
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/__init__.py", line 62, in async_setup_entry
    store = await async_get_registry(hass)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/store.py", line 524, in async_get_registry
    return cast(SmartIrrigationStorage, await task)
                                        ^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/store.py", line 519, in _load_reg
    await registry.async_load()
  File "/config/custom_components/smart_irrigation/store.py", line 191, in async_load
    maximum_duration = zone[ZONE_MAXIMUM_DURATION]
                       ~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'maximum_duration'

as I said: remove all installations of this integration, reboot HA, install. If that doesn't help remove the storage file manually after uninstall.

gatonero commented 9 months ago

beta29 is running, smart_irrigation.reset_bucket doesn't reset duration

jeroenterheerdt commented 9 months ago

any logs? diagnostic file?

gatonero commented 9 months ago
This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/smart_irrigation/store.py:414
Integration: Smart Irrigation (documentation, issues)
First occurred: 01:20:05 (2 occurrences)
Last logged: 01:20:30

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/websockets.py", line 176, in post
    await coordinator.async_update_zone_config(zone, data)
  File "/config/custom_components/smart_irrigation/__init__.py", line 732, in async_update_zone_config
    await self._async_calculate_all()
  File "/config/custom_components/smart_irrigation/__init__.py", line 387, in _async_calculate_all
    modinst = self.getModuleInstanceByID(zone.get(const.ZONE_MODULE))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/__init__.py", line 428, in getModuleInstanceByID
    m = self.store.async_get_module(module_id)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/smart_irrigation/store.py", line 414, in async_get_module
    res = self.modules.get(int(module_id))
                           ^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
gatonero commented 9 months ago

Good Night! It's 2 am. Configured two Proxmox nodes and a cluster today and moved my HA installation to a new VM. That's enough for today. :-), beside some blueprinting (trigger variables, never done before) ughh.

First push to your repository, hope I didn't disturb something.

Now tired. Better stop now, before something crashes.

jeroenterheerdt commented 9 months ago

is this still happening? did you try uninstalling / removing storage file (there is a bug that uninstall doesn't remove storage file) / installing?

gatonero commented 9 months ago

I'm on v2023.9.0-beta1. The issue still exists. The age of the storage file is 1 hour. So it must have been removed.

BTW: I installed a brand new HA instance to play with a test system for beta versions. I installed Smart Integration afterwards I wanted to change from v0.0.81 to beta. There was no option to redownload beta.

jeroenterheerdt commented 9 months ago

I'm on v2023.9.0-beta1. The issue still exists. The age of the storage file is 1 hour. So it must have been removed.

BTW: I installed a brand new HA instance to play with a test system for beta versions. I installed Smart Integration afterwards I wanted to change from v0.0.81 to beta. There was no option to redownload beta.

can you send me a config file from the v2023.9.0-beta1 version that has this issue?

gatonero commented 9 months ago

It's the zone "ATest" with id: 5

config_entry-smart_irrigation-512b6e788a370352b48f22221147809e.json.txt

The version in that file is still 2023.8.4 but made with v2023.9.0-beta1

gatonero commented 9 months ago

v2023.9.0-beta2 didn't reset duration also.

jeroenterheerdt commented 9 months ago

I just tried this using your diag file on v2023.9.0-beta2 and I am not seeing any problem. Before service call: image

Service call: image

After service call: image

Log after service call: image

So I am really not sure what is going on here...

jeroenterheerdt commented 9 months ago

I added some extra checking in beta3, but still not sure what is going on.

jeroenterheerdt commented 9 months ago

is this still happening in latest beta?

gatonero commented 9 months ago

This bug still exists in v2023.9.0-beta8 but only for manually calculated zones.

config_entry-smart_irrigation-a008ef644d0b6e30f0be7b955e0fe1bb.json.txt

jeroenterheerdt commented 9 months ago

This bug still exists in v2023.9.0-beta8 but only for manually calculated zones.

config_entry-smart_irrigation-a008ef644d0b6e30f0be7b955e0fe1bb.json.txt

which is to be expected... in manual mode bucket is not used at all. You set your duration right there, manually and that's it. So this is by design. We should clarify this in the documentation though.

gatonero commented 9 months ago

So I made it clear in README.md

I close this issue because the reason was misunderstanding.