donavanbecker / homebridge-rainbird

The Homebridge RainBird plugin allows you to access your RainBird Controller from HomeKit with Homebridge.
ISC License
20 stars 0 forks source link

Bug: When seasonal adjustment exceeds 3600 #485

Closed tbaur closed 1 year ago

tbaur commented 1 year ago

Describe The Bug

Remaining duration warning, when seasonal adjustment exceeds 3600

To Reproduce

Seasonal adjustment is over 100%

Expected behavior

No warning

Relevant log output

[5/14/2023, 6:16:23 AM] [RainBird] Zone 7: Running
[5/14/2023, 6:16:23 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 4570 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:16:23 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 4570 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:16:23 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 4570 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:16:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 4542 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:16:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 4542 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:16:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 4542 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:21:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 4243 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:21:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 4243 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:21:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 4243 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:26:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 3943 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:26:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 3943 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:26:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 3943 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:31:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 3642 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:31:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 3642 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.
[5/14/2023, 6:31:50 AM] [homebridge-rainbird] This plugin generated a warning from the characteristic 'Remaining Duration': characteristic was supplied illegal value: number 3642 exceeded maximum of 3600. See https://homebridge.io/w/JtMGR for more info.

Config for homebridge-rainbird

It appears that when seasonal adjustment has pushed beyond 100%, this warning appears for each program where this applies. In this case, program A has 2 zones, 127% seasonal adjustment, meaning instead of 2hrs it is 2hrs 34min run time across the 2 zones. So while it is programmed for 2hrs, it will run for 2hrs 34min instead. Seasonal adjustment seems to mostly change with ambient temp, and will go up/down as needed.

Screenshots

No response

Device & Model

ESP-ME3

Node.js Version

current

NPM Version

current

Homebridge Version

current

Homebridge Rainbird Plugin Version

current

Homebridge Config UI X Plugin Version

No response

Operating System

macOS

mantorok1 commented 1 year ago

Hi @tbaur, It appears that your Rainbird is exceeding the maximum allowed "Remaining Duration" which is 3600 seconds (i.e 1 hour). This limit appears to be set by Homebridge or HomeKit (see the Homebridge API) and is imposed on both valves (zones) and the entire irrigation system. The plugin has to operate within the restrictions of Homebridge/HomeKit. When I get a chance I'll try to see if that Max Value can be set higher. If not the best we may be able to do is check the remaining duration and if its greater than 1 hour set set it to 1 hour so the warnings do not show in the logs. The downside is that it will not show the correct remaining duration though.

tbaur commented 1 year ago

Interesting. Yes this is what seasonal adjustment does -- increases or decreases the programmed zone run time based on the season / temp. Most of my zones only run for a max 1hr, but seasonal adjustment can increase that beyond 1hr. I guess no one thought irrigation could run for more than 1hr? I can program a zone to run for 6hrs 59min if I wanted.

tbaur commented 1 year ago

If it can not be fixed in the plugin, perhaps catching the warning and writing an appropriate log entry instead, showing the increase even if via a second log entry, rather then assuming it's always 1hr...

mantorok1 commented 1 year ago

Hi @tbaur, I attempted to increase the Max Value property to 7200 (2 hours) of the "Remaining Duration" characteristic and although it did accept the value Homebridge still generated the same log message as you posted. As mentioned above I could add a check for the value and if it exceeds 3600 then it will set it to 3600 and log a message but all this is really doing is swapping one log message for another.

After a bit more digging it appears this might be a limit imposed by Apple. This is from Apple's HomeKit ADK GitHub repo. Note the "Maximum Value"

/**
 * Remaining Duration.
 *
 * This characteristic describes the remaining duration on the accessory. Notifications on this characteristic must only
 * be used if the remaining duration increases/decreases from the accessory's usual countdown of remaining duration and
 * when the duration reaches 0. e.g. It must not send notifications when the remaining duration is ticking down from
 * 100,99,98... if 100 was the initial Set duration. However, if the remaining duration changes to 95 from 92 (increase)
 * or 85 from 92 (decrease which is not part of the usual duration countdown), it must send a notification.
 *
 * This duration is defined in seconds.
 *
 * This characteristic requires iOS 11.2 or later.
 *
 * - Format: UInt32
 * - Permissions: Paired Read, Notify
 * - Minimum Value: 0
 * - Maximum Value: 3600
 * - Step Value: 1
 *
 * @see HomeKit Accessory Protocol Specification R14
 *      Section 9.78 Remaining Duration
 */
/**@{*/
#define kHAPCharacteristicDebugDescription_RemainingDuration "remaining-duration"

@donavanbecker, do you or anyone else in the Homebridge Dev community know a way to increase this 3600 second limit? If not I guess we could try creating an issue in the above GitHub repo.

donavanbecker commented 1 year ago

@mantorok1 I believe I do. Let me look.

donavanbecker commented 1 year ago

@tbaur and @mantorok1, I was about to add the RemainingDuration: minValueOverride and maxValueOverride overrides. Can you try setting this override to something higher then 3600 and see if that works for you now?

mantorok1 commented 1 year ago

I think I figured it out. My problem was that I wasn't overriding the individual zones' max value, only the irrigation system itself. If I set the maxValue property for all services I don't get the warning message and the time remaining shows correctly. Here's an example of the code I used:

<service>
  .getCharacteristic(this.platform.Characteristic.RemainingDuration)
  .setProps({
    maxValue: 7200,
  });

So what should we set the maxValue to be?

Given that the RainBird app allows a zone to run for up to 7 hours we could set each valve service to run for a maximum of 25,200 seconds?

The irrigation system is supposed to show the total time remaining (from all zones) but at the moment the plugin only shows the time remaining for the active zone as we haven't yet figured out how to obtain the info from the other zones. I don't think this figure is displayed in the Home app anyway so we could just set it to some ridiculously high value like 4294967295 (the maximum uint32 value)

tbaur commented 1 year ago

Fwiw, seems fine to set it to the Rainbird max, which does seem quite high anyway. The water police would surely get upset if a zone was in fact running for 7 hours (ha). Great to hear there is progress and the likelihood of correct time reporting! Thanks for digging into it.

mantorok1 commented 1 year ago

@donavanbecker, I just checked out your beta branch where I can see you've made those changes mentioned above. Let me test it out and see how it goes.

mantorok1 commented 1 year ago

Hi @donavanbecker, I've pushed some minor changes to the beta branch, however, I couldn't get it to work. It appears that the new settings for the overrides are not being persisted so the min & max values are just defaulting to 0 and 3600.

Do you mind looking into this as I've got some other things to take care off

donavanbecker commented 1 year ago

Yes, @tbaur can you try the latest beta? I think I got it.

You will have to set the amount you want in the config. there is a section for Remaining Duration Override

tbaur commented 1 year ago

Installed the beta. I'd suggest setting the config option to more than 3600 by default, but regardless I set it to 10,800 which is more than I'd need.

Forced program to run, with 2 zone active for 1h36m (seasonal adjustment at 160%)

[5/21/2023, 11:59:31 AM] [RainBird] Program A: Running [5/21/2023, 11:59:31 AM] [RainBird] Zone 5: Running

Standard logging config is set. No warning or other log entries (thumbs up). Home app shows the full run time remaining (ex. 1:32:45).

Full logs for the program run, where both zones were stopped by the Home app after a few min.

[5/21/2023, 11:59:31 AM] [RainBird] Program A: Running [5/21/2023, 11:59:31 AM] [RainBird] Zone 5: Running [5/21/2023, 12:02:35 PM] [RainBird] Zone 5: Complete [5/21/2023, 12:02:35 PM] [RainBird] Zone 7: Running [5/21/2023, 12:02:49 PM] [RainBird] Zone 7: Complete [5/21/2023, 12:02:49 PM] [RainBird] Program A: Complete

donavanbecker commented 1 year ago

So all is good? @tbaur

tbaur commented 1 year ago

Best I can tell, yep! Without running through an entire program.

On May 21, 2023, at 1:41 PM, Donavan Becker @.***> wrote:

So all is good? @tbaur — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

donavanbecker commented 1 year ago

I will wait a little more then a week and then publish a new version if I don't hear anything.

tbaur commented 1 year ago

I’ll force the next program to run over 3600 — it’s cooled outside, so seasonal adjustment has come back down. Then we’ll know, I’ll report back. Thanks again for sorting!

On May 21, 2023, at 2:32 PM, Donavan Becker @.***> wrote:

I will wait a little more then a week and then publish a new version if I don't hear anything. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

tbaur commented 1 year ago

Full run complete, no warnings and one zone in the program ran for 1hr15min. Looks like we’re good here.

An extra touch in the logs could be:

<< deleted and moved to new feature request >>

donavanbecker commented 1 year ago

Open a new issue requesting that and we will get it in before we release this version.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 year ago

This issue has been closed as no further activity has occurred.

tbaur commented 1 year ago

we're good, can release