Closed ferrett013 closed 2 years ago
First off, thanks for using my plugin! I have an idea of what this might be. I'll need you to make a GET request to the /jo
endpoint on your sprinkler system. So something like: http://192.168.7.162/jo?pw=<md5 string>
. If you can paste your results in here for me to look at, that would be great!
Thank you Kory for the fast response! (And making the plugin!) Below is the response I got:
{"fwv":216,"tz":24,"ntp":1,"dhcp":1,"ip1":192,"ip2":168,"ip3":7,"ip4":162,"gw1":192,"gw2":168,"gw3":4,"gw4":1,"hp0":80,"hp1":0,"hwv":23,"ext":1,"sdt":5,"mas":0,"mton":0,"mtof":0,"urs":0,"rso":0,"wl":100,"den":1,"ipas":0,"con":150,"lit":100,"dim":15,"uwt":0,"ntp1":50,"ntp2":97,"ntp3":210,"ntp4":169,"lg":1,"mas2":0,"mton2":0,"mtof2":0,"fwm":1,"fpr0":100,"fpr1":0,"re":0,"reset":0,"dexp":2,"mexp":6,"hwt":172}
No problem! It looks like the property devid
is missing from this payload. It's defined in the latest versions of their API documentation so I figured it would always be supplied. Do you know what version of open sprinkler you are running?
Sure!
App Version: 2.2.5 Firmware: 2.1.6 (1) Hardware Version: 2.3 AC
Ok so I wrote all my stuff based off version 2.1.9. But…your version says it also has devid. So I think this will mean that I’ll just have to handle this situation better. I’ll work on getting a fix out in the coming days.
Update: I had been meaning to release v2.0.0 for a while now, but got caught up in other things. v2.0.0 drops support for Node 10 and 12. I'll be starting on this issue now and hopefully get a beta release out soon for you to test with.
Awesome, thank you Kory!
Ok I just published a beta version for you to test with! I believe it should fix your problems. You can install it via the Homebridge UI, if you need help with that let me know. You can find the release here. Let me know if it works for you!
Thank you Kory! I installed the beta version and ran into the (new!) error below. I tried uninstalling the plugin and start from scratch in case there was an issue with the pre-existing config, but the error is persisting. Let me know if you need any follow up data (my config file hasn't changed from before in a significant way) to help ID the issue- thank you!
[7/8/2022, 11:01:08 AM] [homebridge-opensprinkler-api] The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
What kind of unit do you have? Is it a Raspberry PI? Or is it one of the units from OpenSprinkler themselves? If it's OSBee, I don't think I can support that because the API for that is very different. But I'm interested to know what's going on. Because I have a feeling you've got some unit that uses a different version of the API that I'm not aware of.
It's a 2.3 version hardware from OpenSprinkler themselves (at least it's branded with OS's logo and it looks like the v2.3 photo located here). Sorry to be a squeaky wheel! Are there any API responses I can check to try to root out the issue? Thanks Kory!
No worries! Haha yeah my guess is the API for that unit is just a little different. I based all my code off of OSPi because I have a Raspberry Pi running my system. But yeah as far as what might help, can you request your /ja
endpoint? That one basically returns everything from the system. Then I can compare against it and such and see what the differences might me.
Sorry for the delay Kory- here's the output of requesting the /ja
endpoint (I've scrubbed out my exact location in the loc
variable):
{"settings":{"devt":1657464461,"nbrd":2,"en":1,"rd":0,"rs":0,"rdst":0,"loc":"xx.xxxx,xx.xxxx","wtkey":"","sunrise":397,"sunset":1169,"eip":1269170743,"lwc":1657464310,"lswc":0,"lrun":[4,99,24,1657461923],"sbits":[0,0,0],"ps":[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],"wto":{}},"programs":{"nprogs":4,"nboards":2,"mnp":28,"mnst":4,"pnsize":20,"pd":[[1,127,0,[300,0,0,0],[0,0,0,0,0,0,0,0,240,240,0,0,0,0,0,0],"Raised Garden Beds"],[0,42,0,[210,0,0,0],[600,600,600,900,900,600,600,600,600,600,600,600,0,0,0,0],"Spring and Fall Lawn"],[1,42,0,[210,0,0,0],[900,0,900,1200,1200,900,900,900,900,900,900,900,600,0,0,0],"Summer Lawn"],[0,85,0,[210,0,0,0],[420,600,420,420,420,0,0,0,0,0,0,420,0,0,0,0],"Extra Front Lawn"]]},"options":{"fwv":216,"tz":24,"ntp":1,"dhcp":1,"ip1":192,"ip2":168,"ip3":7,"ip4":162,"gw1":192,"gw2":168,"gw3":4,"gw4":1,"hp0":80,"hp1":0,"hwv":23,"ext":1,"sdt":5,"mas":0,"mton":0,"mtof":0,"urs":0,"rso":0,"wl":100,"den":1,"ipas":0,"con":150,"lit":100,"dim":15,"uwt":0,"ntp1":50,"ntp2":97,"ntp3":210,"ntp4":169,"lg":1,"mas2":0,"mton2":0,"mtof2":0,"fwm":1,"fpr0":100,"fpr1":0,"re":0,"reset":0,"dexp":2,"mexp":6,"hwt":172},"status":{"sn":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"nstations":16},"stations":{"masop":[255,255],"ignore_rain":[0,0],"masop2":[0,0],"stn_dis":[0,0],"stn_seq":[255,255],"stn_spe":[0,0],"snames":["S01 Front Hell Strip","S02 Do Not Use","S03 Stone Hell Strip","S04 Main Front Yard 1","S05 Main Front Yard 2","S06 Mid Backyard Side","S07 Soccer Field","S08 Main Backyard","S09 Front Flower Beds","S10 Raised Beds Backyard","S11 Side Soccer Field","S12 Do Not Use","S13 Front SW Hell Strip","S14","S15","S16"],"maxlen":24}}
Thanks for sending that over! I'll get to looking at this in the next couple of days and get back to you on what I think might be the problem. 👍
Alright so turns out your system also doesn't report the MAC address! haha so I've resorted to using the location attribute. So I'm thinking that it should be working now for you? I released a new version. So give it a shot, and let me know if something else is broken!
If it is, I'd like to see if it's possible for you to update your firmware. I don't know if you have an update, but I'd like to see if that's possible as a next approach.
The new beta works! Thank you Kory! I'll put trying to get an update to my OS controller this week and I'll reply back on this issue if that allows me to use the non-beta v2.0 version of the plugin- thanks!
Awesome! Yeah let me know how that goes. If you do get it updated and it happens to start returning the mac address from the api, keep in mind that you'll get 2 sprinkler systems showing up in the home app. You'll want to check which one is in the cache before you do anything and then that way you can remove it if you need to. You can remove a single accessory from the cache in the Homebridge settings.
Hey Kory! I updated my OS to firmware 2.1.7 (the most up-to-date version I can use on the hardware), however unfortunately a similar error to the original Cannot read properties of undefined (reading 'toString')
is persisting when I use v2.0 of the plugin. I think unless you have any other ideas for how to proceed I'll start researching alternative controllers that work with HomeKit more reliably (the unit is something we inherited from our house's previous occupants).
Hey so I can totally release that beta version to work with your particular controller! I think the beta version is actually a good update anyways. The value I was using before wasn't very unique in my opinion. It's in a much better state now.
Unless you really want to get something different, that beta version should work for you. And will work for everyone else as well. I will be publishing this beta release here soon anyways. But let me know what you want to do though!
Oh! That would be great- I wasn't sure if it the beta was compatible with the main release.
Yeah I plan on putting out the release this weekend. So you said the plugin worked for you in the latest beta, right? Did you test out starting and stopping valves too? I just want to make sure it all works for you. (including rain delay)
If you can confirm it all does, then I'll definitely release it this weekend.
Sorry for the delay! Yes, all the valve functionality and rain delay work great on the beta release.
No problem! Thanks for verifying that for me! I'll get the release out most likely tonight then. Thank you for all your help!
Thank you!
I put out the release last night, so you're good to update to that now! Thanks for all your feedback and helping me figure this out!
Describe The Bug:
Hi! I'm trying to setup the plugin with my OpenSprinkler instance and receive the following error when restarting my Homebridge instance:
[HomebridgeOpenSprinklerApi] Cannot read property 'toString' of undefined
To Reproduce:
Hopefully the config file below and screenshot of my OpenSprinkler stations helps to reproduce the issue!
Expected behavior:
To initialize the plug in and surface my OpenSprinkler stations as accessories
Logs:
Plugin Config:
Screenshots:
Environment:
Thank you!