hass-opensprinkler icon indicating copy to clipboard operation
hass-opensprinkler copied to clipboard

[%key:common::config_flow::error::cannot_connect%]

Open jjanderson opened this issue 4 years ago • 85 comments

Hi,

I have now deleted all the trace elements of the pre 1.0 version.

I have uninstalled from HACS.

I rebooted

I then re-installed in HACS.

When I try and configure in the integrations, I get [%key:common::config_flow::error::cannot_connect%]

Further info:

I am running OSPI. My url I have tried is:

  • IP address - Failed with same error
  • http://IP address - Failed with same error
  • IP address:8080 - Failed with same error
  • http://IP address:8080 - Failed with same error

Password is the password, but I also tried with the old Hashed password and I got a different error around authentication

Mac address --> I used the mac address of the raspberry pi

Controller name --> Left as is...

jjanderson avatar May 31 '20 23:05 jjanderson

What was the host and port you were using with the old version? I am assuming you used: http://[host]:[port]

Its weird you are getting auth error with the hased password so it means its actually connecting.

Are there any other logs in the HA logs? (Developer -> Logs)

vinteo avatar Jun 01 '20 00:06 vinteo

I did notice the string was off a while back and forgot to create an issue :(

travisghansen avatar Jun 01 '20 00:06 travisghansen

Yea the string works for core integration but not for custom, I hope they will support it in the future. I left it cause it still mostly provided the relevant error

vinteo avatar Jun 01 '20 00:06 vinteo

Ah ok

travisghansen avatar Jun 01 '20 00:06 travisghansen

I have had much the same experience as jjanderson. I was updating from the previous version, followed the instructions on removal and ran into this same error. Tried all the different combinations of port and ip address similar to jjanderson and have been unable to connect. Additionally I have DNS name setup for my controller -- that also doesn't connect.

http://IP address:port http://ip address ip address ip address:port http://dns name http://dns name:port dns name dns name:port

Nothing works. I have tried the old md5 hashed password, unhashed. For mac address I was using the MAC address of the controller. I looked the code and it looks like this is just used to establish a unique id and not for connectivity? So I also tried just putting some text in there as well.

I am running on docker.

This was all I could find in my HA logs:

Log Details (ERROR) Logger: backoff Source: util/thread.py:20 First occurred: 8:15:05 PM (1 occurrences) Last logged: 8:15:05 PM

Giving up request_http(...) after 3 tries (pyopensprinkler.OpenSprinklerConnectionError: Cannot connect to controller)

jdohnstad avatar Jun 01 '20 01:06 jdohnstad

Its basically supposed to the same URL you use to open the OpenSprinkler UI. I assume that loads in the browser?

I find OS quite finicky when you try to access it using different IP/Hosts. Try rebooting the OS controller and loading the OS UI and then use the same url for the integration.

You are right about the mac address, its not used for connectivity so should not be relevant here

vinteo avatar Jun 01 '20 01:06 vinteo

What firmware version are you each on?

travisghansen avatar Jun 01 '20 02:06 travisghansen

I updated to hass-opensprinkler 1.0.1, restarted HAS, rebooted OpenSprinkler controller. I verified the IP address, can access it directly. I attached to the docker container and verified it can ping the ip as well (this was working pre-1.0.0, so seems unlikely to be connectivity). OpenSprinkler firmware is 2.1.7.

jdohnstad avatar Jun 01 '20 04:06 jdohnstad

Pre 1.0.0 the requests library was used...now we use httplib2 and I’m wondering if there’s something more stringent with the request with older firmware (like a missing header or something that was sent by requests perhaps but not httplib2).

travisghansen avatar Jun 01 '20 04:06 travisghansen

That could be a possibility, but its hard to test without it failing for us. Maybe we can switch to request and test.

@hellfire51 @jjanderson are you guys comfortable with python to be able to run the pyopensprinkler module by itself with we created a git branch with some changes to help us test?

vinteo avatar Jun 01 '20 05:06 vinteo

Or maybe reach out privately and give us a temporary password to run some tests..

travisghansen avatar Jun 01 '20 06:06 travisghansen

I am not really comfortable with giving access sorry...

If you could send me steps, i am happy to help with testing in python...

I am running firmware 2.1.8(4) on ospi..

jjanderson avatar Jun 01 '20 07:06 jjanderson

Is there an particular reason why you guys have not upgraded to 2.1.9?

vinteo avatar Jun 01 '20 09:06 vinteo

Will try that...

jjanderson avatar Jun 01 '20 11:06 jjanderson

Could be hardware related as well. I also don’t know when /ja was added.

travisghansen avatar Jun 01 '20 13:06 travisghansen

I used to get an update notification when new firmware was available.

I have now tried updaing the firmware but it does not seem to work... Have logged a ticket here: https://openthings.freshdesk.com/support/tickets/9207

jjanderson avatar Jun 01 '20 13:06 jjanderson

Same error Firmware 2.1.5(1) Hardware 2.1AC Was working before :-(

dvbit avatar Jun 01 '20 16:06 dvbit

Is there an particular reason why you guys have not upgraded to 2.1.9?

Upgrading past 2.1.5 Requires modifying (soldering some pins) and having a HW programmer . Joys of opensource

dvbit avatar Jun 01 '20 16:06 dvbit

funny, got mine (ospi) to 2.1.8(4)... will wait to hear from Ray as it is not clear to me on the best way forward with the firmware...

jjanderson avatar Jun 01 '20 16:06 jjanderson

Ok, I think it’s pretty clear there’s some minor difference that’s required in the request for the older firmware. When I get back to my desk I’ll send over some basic curl commands to have you try and we’ll see what happens.

travisghansen avatar Jun 01 '20 16:06 travisghansen

I too am basically stuck at firmware 2.1.5 due to having version 2.1 hardware. I have the same issue connecting with the new integration. Below are the two errors that are logged in HA while attempting to setup the integration. Hopefully this information is helpful to someone.

Logger: backoff Source: util/thread.py:20 First occurred: 8:49:06 AM (2 occurrences) Last logged: 9:12:20 AM

Giving up request_http(...) after 3 tries (pyopensprinkler.OpenSprinklerConnectionError: Cannot connect to controller)

Logger: custom_components.opensprinkler.config_flow Source: custom_components/opensprinkler/config_flow.py:49 Integration: OpenSprinkler (documentation) First occurred: 9:13:31 AM (1 occurrences) Last logged: 9:13:31 AM

Unexpected exception Traceback (most recent call last): File "/config/custom_components/opensprinkler/config_flow.py", line 49, in async_step_user await self.hass.async_add_executor_job(controller.refresh) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.7/site-packages/pyopensprinkler/init.py", line 107, in refresh for i, _ in enumerate(self._state["programs"]["pd"]): KeyError: 'programs'

rgroce avatar Jun 01 '20 19:06 rgroce

Ok cool. I’ll send send over some curl commands to have everyone to send over the results which should help.

travisghansen avatar Jun 01 '20 19:06 travisghansen

OK, if everyone could run this it would be helpful:

curl -v 'http://ip:port/ja?pw=<md5hashed password>'

And subsequently for those that want to attempt hacking the code:

diff --git a/pyopensprinkler/__init__.py b/pyopensprinkler/__init__.py
index 5a84f5d..e4a2791 100644
--- a/pyopensprinkler/__init__.py
+++ b/pyopensprinkler/__init__.py
@@ -60,7 +60,10 @@ class Controller(object):
             qs = qs + "&" + raw_qs
         url = f"{self._baseUrl}{path}?{qs}"
 
+        print("url: " + str(url))
         (resp, content) = self.request_http(url)
+        print("resp: " + str(resp))
+        print("content: " + str(content))
 
         refresh = self._opts["auto_refresh_on_update"]["enabled"]
         if self.refresh_on_update is not None:
@@ -83,8 +86,12 @@ class Controller(object):
 
     @on_exception(expo, Exception, max_tries=3)
     def request_http(self, url):
+        headers = {"Accept": "*/*"}
         try:
-            (resp, content) = self._http_client.request(url, "GET")
+            (resp, content) = self._http_client.request(
+                url, "GET", headers=headers
+            )
+
             content = json.loads(content.decode("UTF-8"))
 
             if len(content) == 1 and not content["result"] and content["fwv"]:

From what I can tell the most simple difference between requests and httplib2 with these basic requests is that requests include the Accept header and httplib2 does not.

travisghansen avatar Jun 01 '20 22:06 travisghansen

+ print("url: " + str(url))

Will this log a password?

sdwilsh avatar Jun 01 '20 22:06 sdwilsh

Yes as well as the headers (since the pw is in the path)...cleanse the output before sending it over and/or clean logs as necessary.

travisghansen avatar Jun 01 '20 22:06 travisghansen

Maybe change it to:

print("url: " + str(f"{self._baseUrl}{path}"))

In this case we probably don't need to know the full url. this will not log the password

vinteo avatar Jun 01 '20 22:06 vinteo

I can send a variant that will print it with params before the pw is added in a bit...afk at the moment.

travisghansen avatar Jun 01 '20 22:06 travisghansen

I pretty-printed the JSON and redacted a few things:

$ curl -v 'http://10.0.0.56:80/ja?pw=<REDACTED>'
* STATE: INIT => CONNECT handle 0x600057a80; line 1404 (connection #-5000)
* Added connection 0. The cache now contains 1 members
*   Trying 10.0.0.56...
* TCP_NODELAY set
* STATE: CONNECT => WAITCONNECT handle 0x600057a80; line 1456 (connection #0)
* Connected to 10.0.0.56 (10.0.0.56) port 80 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x600057a80; line 1573 (connection #0)
* Marked for [keep alive]: HTTP default
* STATE: SENDPROTOCONNECT => DO handle 0x600057a80; line 1591 (connection #0)
> GET /ja?pw=<REDACTED> HTTP/1.1
> Host: 10.0.0.56
> User-Agent: curl/7.59.0
> Accept: */*
>
* STATE: DO => DO_DONE handle 0x600057a80; line 1670 (connection #0)
* STATE: DO_DONE => WAITPERFORM handle 0x600057a80; line 1795 (connection #0)
* STATE: WAITPERFORM => PERFORM handle 0x600057a80; line 1811 (connection #0)
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Content-Type: application/json
* Marked for [closure]: Connection: close used
< Connection: close
< Access-Control-Allow-Origin: *
< Cache-Control: max-age=0, no-cache, no-store, must-revalidate
<
* nread <= 0, server closed connection, bailing
* STATE: PERFORM => DONE handle 0x600057a80; line 1980 (connection #0)
* multi_done
* Closing connection 0
* The cache now contains 0 members
* Expire cleared
{
	"settings": {
		"devt": 1591044395,
		"nbrd": 1,
		"en": 1,
		"rd": 0,
		"rs": 0,
		"rdst": 0,
		"loc": "<REDACTED>",
		"wtkey": "<REDACTED>",
		"sunrise": 317,
		"sunset": 1237,
		"eip": <REDACTED>,
		"lwc": 1591042952,
		"lswc": 1591042952,
		"lrun": [
			2,
			1,
			189,
			1590991588
		],
		"sbits": [
			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
			]
		],
		"wto": {},
		"ifkey": ""
	},
	"programs": {
		"nprogs": 2,
		"nboards": 1,
		"mnp": 17,
		"mnst": 4,
		"pnsize": 20,
		"pd": [
			[
				3,
				127,
				0,
				[
					16424,
					0,
					0,
					0
				],
				[
					2700,
					2700,
					2700,
					0,
					0,
					0,
					0,
					0
				],
				"Morning"
			],
			[
				2,
				127,
				0,
				[
					12393,
					0,
					0,
					0
				],
				[
					1500,
					1200,
					1200,
					0,
					0,
					0,
					0,
					0
				],
				"Evening"
			]
		]
	},
	"options": {
		"fwv": 217,
		"tz": 28,
		"ntp": 1,
		"dhcp": 1,
		"ip1": 10,
		"ip2": 0,
		"ip3": 0,
		"ip4": 56,
		"gw1": 10,
		"gw2": 0,
		"gw3": 0,
		"gw4": 1,
		"hp0": 80,
		"hp1": 0,
		"hwv": 23,
		"ext": 0,
		"sdt": 0,
		"mas": 8,
		"mton": 0,
		"mtof": 0,
		"urs": 0,
		"rso": 1,
		"wl": 7,
		"den": 1,
		"ipas": 0,
		"con": 150,
		"lit": 100,
		"dim": 15,
		"uwt": 1,
		"ntp1": 10,
		"ntp2": 0,
		"ntp3": 0,
		"ntp4": 1,
		"lg": 1,
		"mas2": 0,
		"mton2": 0,
		"mtof2": 0,
		"fwm": 0,
		"fpr0": 100,
		"fpr1": 0,
		"re": 0,
		"dns1": 10,
		"dns2": 0,
		"dns3": 0,
		"dns4": 1,
		"sar": 0,
		"ife": 63,
		"reset": 0,
		"dexp": 0,
		"mexp": 6,
		"hwt": 172
	},
	"status": {
		"sn": [
			0,
			0,
			0,
			0,
			0,
			0,
			0,
			0
		],
		"nstations": 8
	},
	"stations": {
		"masop": [
			127
		],
		"ignore_rain": [
			0
		],
		"masop2": [
			0
		],
		"stn_dis": [
			120
		],
		"stn_seq": [
			127
		],
		"stn_spe": [
			0
		],
		"snames": [
			"Front Yard",
			"Side Yard",
			"Back Yard",
			"S04",
			"S05",
			"S06",
			"S07",
			"Pump"
		],
		"maxlen": 24
	}
}

jdohnstad avatar Jun 02 '20 04:06 jdohnstad

@hellfire51 can you try to apply the header portion of the patch above by chance and see what happens? You’ll need to hack the files and the restart hass.

travisghansen avatar Jun 02 '20 05:06 travisghansen

An update, I have dusted off my old raspberrypi and compiled a few versions of the firmware to test:

  • 2.1.5 - I could reproduce the error reported by @rgroce , fix incoming https://github.com/vinteo/py-opensprinkler/pull/30
  • 2.1.7 - could not compile :(
  • 2.1.6, 2.1.8 - compile worked but could not reproduce connection errors

But I have included the header change and some better error handling/msgs to the PR above, we will see if that helps.

vinteo avatar Jun 02 '20 11:06 vinteo

Hi,

just want to confirm that on new installation (my first instalation of Home Assistant, just 2days ago) it's not working from start. Also was trying above URL options and get same error [%key:common::config_flow::error::cannot_connect%]

System | HassOS 4.8 HACS Integration version: | 1.0.3

OpenSprinkler (microcontroller): App Version: 2.1.10 firmware 2.1.9 (3) hardware: 3.2 - AC

Thank you for trying to resolve this. Super work with OpenSprinkler.

mmway avatar Jun 02 '20 13:06 mmway

Are you quite certain you put in the correct url and password? Is the url reachable from the hass installation? With all the latest stuff I would think its operating properly...meaning there’s an actual failure and not an incompatibility.

travisghansen avatar Jun 02 '20 13:06 travisghansen

Working! I've just updated OpenSprinkler Integration for Home Assistant to version that appeared today (v 1.0.2) and with the same data pasted - it worked. Thank you :)

mmway avatar Jun 02 '20 14:06 mmway

Same. v 1.0.2 is working with my 2.1 hardware and firmware 2.1.5. Thank you for taking the time to support this older hardware and firmware.

rgroce avatar Jun 02 '20 14:06 rgroce

Nice! Can you each try the available services in hass and ensure they work? I'm pretty sure much of the underlying library is not yet compatible with pre 2.1.9 options but most of the things that won't work aren't (yet) exposed as services in hass anyway.

Also try the switches for the controller, stations, and programs and make sure those work as expected.

travisghansen avatar Jun 02 '20 14:06 travisghansen

Uhm 2.1 hw and 2.5 fw here Tried. No success. What is the exact format to be used in the config popup . ? Ty

dvbit avatar Jun 02 '20 16:06 dvbit

@dvbit just standard url: http(s)://<host>[:port]

Can you send over the error you got?

travisghansen avatar Jun 02 '20 16:06 travisghansen

Doh! Wrong port. And ... Really wonderful release . Excellent

dvbit avatar Jun 02 '20 16:06 dvbit

@dvbit nice! We're just getting started, some great stuff coming up :)

travisghansen avatar Jun 02 '20 16:06 travisghansen

Alright gents... some good news... managed to update the firmware to 2.1.9(3) and the integration installation has now been successfull..... I am therefore closing this ticket.... Thanks for all your efforst and support.... later...

jjanderson avatar Jun 03 '20 09:06 jjanderson

Unfortunately, I am also experiencing this problem my Opensprinkler is one of the Original self-built units and is not so easy to update it. At present it runs Firmware 2.1.5(1) and has Hardware version of 2.1-AC, unfortunately, I am now experiencing the same problem.

Updating the firmware on this model seems to involve the use of an AVR ISP programmer and the soldering of a 2x3 male pin header, It was all good up until the recent update has anyone any suggestions which doesn't involve quite so much upheaval?

Details of all that is involved in the firmware update can be found here:

https://openthings.freshdesk.com/support/solutions/articles/5000668400-updating-opensprinkler-2-1-to-firmware-2-1-6-and-beyond-

Thanks

osteospurnum avatar Jun 03 '20 14:06 osteospurnum

@osteospurnum did you update to 1.0.2+?

travisghansen avatar Jun 03 '20 14:06 travisghansen

Thanks, I hadn't seen the most recent update. I will do that

osteospurnum avatar Jun 03 '20 14:06 osteospurnum

Cool, let us know. I'm sure there's still some loose ends with older stuff in general but our intent is to make it as functional as possible.

travisghansen avatar Jun 03 '20 14:06 travisghansen

Unfortunately, it is still returning the [%key:common::config_flow::error::cannot_connect%] error when trying to setup the integration.

osteospurnum avatar Jun 03 '20 14:06 osteospurnum

Can you share the syntax you're using to input the URL?

travisghansen avatar Jun 03 '20 14:06 travisghansen

Yes I am using aa.duckdns.org:894 also tried http://aa.duckdns.org:894 192.168.1.8:894 and http://192.168.1.8:894

osteospurnum avatar Jun 03 '20 15:06 osteospurnum

@osteospurnum I have the same setup as you and I have it working. Different in my setup is that I have a static ip and letsencrypt certificate. However to setup the integration I used the internal url so http:\os.mydomain:port

dvbit avatar Jun 03 '20 15:06 dvbit

@osteospurnum OK yeah it should include the protocol etc now http(s)://<host>[:port]

travisghansen avatar Jun 03 '20 15:06 travisghansen

http://192.168.1.8:894

Is the local port not 8080?

jjanderson avatar Jun 03 '20 16:06 jjanderson

For me it's 80 with some brand new AC hardware..but other stuff could default to 8080.

travisghansen avatar Jun 03 '20 16:06 travisghansen

Thanks a lot for all the support. So am I right to say that if I use the URL http:// au******da.duckdns.org:894 An address which works when used in a browser both locally and remotely that should be correct? because it still returns the error. I do have a long password is there perhaps a length limit I just counted and it has 32 characters. My Opensprinkler is accessed through a wireless bridge not that that has been a problem before. It does have a fixed IP and I am running the duckdns addon in Hassio which adds Let's encrypt.

osteospurnum avatar Jun 03 '20 16:06 osteospurnum

I chose 894 as the port and it is set to that in the software its' not been a problem

osteospurnum avatar Jun 03 '20 16:06 osteospurnum

Then it must be something else. What error do you see in the logs (if any)?

travisghansen avatar Jun 03 '20 16:06 travisghansen

I just uninstalled and then reinstalled which showed the following in the logs

_2020-06-03 17:56:13 INFO (MainThread) [hacs.repository.integration.vinteo.hass-opensprinkler] download of manifest.json complete
2020-06-03 17:56:13 INFO (MainThread) [hacs.repository.integration.vinteo.hass-opensprinkler] download of config_flow.py complete
2020-06-03 17:56:13 INFO (MainThread) [hacs.repository.integration.vinteo.hass-opensprinkler] download of services.yaml complete
2020-06-03 17:56:13 INFO (MainThread) [hacs.repository.integration.vinteo.hass-opensprinkler] download of const.py complete
2020-06-03 17:56:13 INFO (MainThread) [hacs.repository.integration.vinteo.hass-opensprinkler] download of strings.json complete
2020-06-03 17:56:13 INFO (MainThread) [hacs.repository.integration.vinteo.hass-opensprinkler] download of __init__.py complete
2020-06-03 17:56:13 INFO (MainThread) [hacs.repository.integration.vinteo.hass-opensprinkler] download of en.json complete
2020-06-03 17:56:13 INFO (MainThread) [hacs.repository.integration.vinteo.hass-opensprinkler] download of switch.py complete
2020-06-03 17:56:15 INFO (MainThread) [hacs.repository.integration.vinteo.hass-opensprinkler] download of sensor.py complete
2020-06-03 17:56:15 INFO (MainThread) [hacs.repository.integration.vinteo.hass-opensprinkler] Reloading custom_component cache
2020-06-03 17:56:15 INFO (SyncWorker_19) [homeassistant.loader] Loaded breaking_changes from custom_components.breaking_changes
2020-06-03 17:56:15 INFO (SyncWorker_3) [homeassistant.loader] Loaded programmable_thermostat from custom_components.programmable_thermostat
2020-06-03 17:56:15 INFO (SyncWorker_4) [homeassistant.loader] Loaded hacs from custom_components.hacs
2020-06-03 17:56:15 INFO (SyncWorker_0) [homeassistant.loader] Loaded var from custom_components.var
2020-06-03 17:56:15 INFO (SyncWorker_14) [homeassistant.loader] Loaded opensprinkler from custom_components.opensprinkler
2020-06-03 17:56:15 INFO (SyncWorker_6) [homeassistant.loader] Loaded variable from custom_components.variable
2020-06-03 17:56:15 INFO (SyncWorker_13) [homeassistant.loader] Loaded sonoff from custom_components.sonoff
2020-06-03 17:56:15 INFO (SyncWorker_15) [homeassistant.loader] Loaded combined from custom_components.combined_

After installing I configured the integration which returned its usual error but nothing shows in the logs

osteospurnum avatar Jun 03 '20 17:06 osteospurnum

Hmm, I guess we'll need you to hack the library files as suggested here: https://github.com/vinteo/hass-opensprinkler/issues/92#issuecomment-637158596 as see if we can get some better insight into what's really going on :(

travisghansen avatar Jun 03 '20 17:06 travisghansen

I don't understand what it means but I am getting:

_* Trying 192.168.1.8:894...

  • TCP_NODELAY set
  • Connected to 192.168.1.8 (192.168.1.8) port 894 (#0)

GET /ja?pw=*********************** HTTP/1.1 Host: 192.168.1.8:894 User-Agent: curl/7.68.0 Accept: /

  • Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Content-Type: application/json < Connection: close < Access-Control-Allow-Origin: * < Cache-Control: max-age=0, no-cache, no-store, must-revalidate <
  • Closing connection 0 _

osteospurnum avatar Jun 03 '20 17:06 osteospurnum

@osteospurnum might want to change your password now FYI, make sure you cleanse any output you send over :(

I'm mostly after hacking the code below the curl example...need to see what's going on with the response from the integration perspective.

travisghansen avatar Jun 03 '20 17:06 travisghansen

I think that maybe beyond my pay grade

osteospurnum avatar Jun 03 '20 18:06 osteospurnum

I wanted to report back that I upgraded to the latest version of hass-opensprinkler and was able to complete the integration installation now. It discovered my programs and stations. I haven't tried any services yet.

jdohnstad avatar Jun 04 '20 02:06 jdohnstad

Nice! Glad we’re getting more coverage.

travisghansen avatar Jun 04 '20 02:06 travisghansen

Thanks for all your assistance with this yesterday Travis. It was greatly appreciated, still unable to set up the integration but I reckon at the moment I am out of options. I will keep looking and let you know if I find the cause.

osteospurnum avatar Jun 04 '20 17:06 osteospurnum

Yeah we need to get some better logging in place for failure scenarios..

travisghansen avatar Jun 04 '20 17:06 travisghansen

Why does the MAC address need to be included? Surely a URL or IP address is sufficient?

AlBrough avatar Jun 15 '20 07:06 AlBrough

Why does the MAC address need to be included? Surely a URL or IP address is sufficient?

The short answer is we need a unique identifier for the device and the HA people don't like url/hostname/ip as that.

However we are hoping in the next OpenSprinkler firmware release this will become optional/not required (only required for non-latest firmware)

vinteo avatar Jun 15 '20 08:06 vinteo

Had the same problem on OSPi 2.19 Got it working eventually by putting http:// at front of the url, in the old hass_opensprinkler I didn't need this included in the config. Also, I take it that now the actual password is used, not the hashed version, as that's what worked for me. Just leaving this here in case anyone else has similar issues. Looking forward to using the new version. Thanks for the work you've put into this.

geejayem99 avatar Jun 16 '20 10:06 geejayem99

Have the same problem. I use integration version 1.1.3 My open sprinkler pi is running APP-Version 2.2.1 and Fimware Version 2.1.9(4)

On HAAS I added the integration Opensprinkler via Configuration-Integration-Add and filled in the fields: URL: http://<IP>:8080 Password: "password in clear text" or "hashed" (neither works) MAC-Address: xx:xx:xx:xx:xx:xx

What am I doing wrong?

the capture shows a successfull tcp handshake betwenn HAAS and OSPI, I also get HTTP1.1 200 OK

passi16 avatar Dec 07 '20 13:12 passi16

I've still got the same problem. Any idea folks?

passi16 avatar Jan 05 '21 00:01 passi16

just wanted to follow up. Tried with new versions of haas and moved ospi to the same subnet as haas. Unfortunately I've still the same issue. Any idea?

passi16 avatar Mar 03 '21 20:03 passi16

I ran into this same problem today installing opensprinkler on a new HASS instance. In the configuration pop-up I used an EXTERNAL IP:8080 with port forwarding on my router, rather than internal 192.168.xxx.xxx and was able to connect.

michaelbashara avatar Aug 11 '21 14:08 michaelbashara

Hi! Has this issue been fixed? Is anybody working on fixing this issue?

nanosonde avatar Nov 20 '21 17:11 nanosonde

Unfortunately not. I have still the same problem

Am 20.11.2021 um 18:51 schrieb nanosonde @.***>:

 Hi! Has this issue been fixed? Is anybody working on fixing this issue?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

passi16 avatar Nov 20 '21 20:11 passi16

Have you tried any of the curl commands mentioned in previous comments?

travisghansen avatar Nov 20 '21 22:11 travisghansen

Have you tried any of the curl commands mentioned in previous comments?

user@ubuntuvm:~$ curl -v 'http://10.10.10.30:8080/ja?pw=md5hash'
*   Trying 10.10.10.30:8080...
* TCP_NODELAY set
* Connected to 10.10.10.30 (10.10.10.30) port 8080 (#0)
> GET /ja?pw=md5hash HTTP/1.1
> Host: 10.10.10.30:8080
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: application/json
< Connection: close
< Access-Control-Allow-Origin: *
< Cache-Control: max-age=0, no-cache, no-store, must-revalidate
< 
{"settings":{"devt":1637604758,"nbrd":1,"en":1,"sn1":0,"sn2":0,"rd":0,"rdst":0,"sunrise":482,"sunset":997,"eip":2965811495,"lwc":1637591208,"lswc":1637591208,"lupt":0,"lrbtc":5,"lrun":[0,99,154,1637597144],"mac":"B8:27:EB:9A:80:29","loc":"51.16786,6.93523","jsp":"https://ui.opensprinkler.com/js","wsp":"weather.opensprinkler.com","wto":{"key":""},"ifkey":"","mqtt":{"en":1,"host":"10.10.10.15","port":1883,"user":"opensprinkler","pass":"mypass"},"wtdata":{"wp":"Manual"},"wterr":0,"sbits":[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]]},"programs":{"nprogs":2,"nboards":1,"mnp":40,"mnst":4,"pnsize":32,"pd":[[64,127,0,[420,720,900,1200],[0,0,900,0,0,0,0,0],"Rasenbewässerung"],[1,36,0,[660,0,0,0],[600,0,0,0,0,0,0,0],"Neu ansaugen Pumpe"]]},"options":{"fwv":219,"tz":52,"hp0":144,"hp1":31,"hwv":64,"ext":0,"sdt":0,"mas":8,"mton":0,"mtof":0,"wl":100,"den":1,"ipas":0,"devid":0,"uwt":0,"ntp1":0,"ntp2":0,"ntp3":0,"ntp4":0,"lg":1,"mas2":0,"mton2":0,"mtof2":0,"fwm":9,"fpr0":100,"fpr1":0,"re":0* Closing connection 0
,"sar":0,"ife":0,"sn1t":0,"sn1o":1,"sn2t":0,"sn2o":0,"sn1on":0,"sn1of":0,"sn2on":0,"sn2of":0,"wimod":169,"reset":0,"dexp":-1,"mexp":24,"hwt":255},"status":{"sn":[0,0,0,0,0,0,0,0],"nstations":8},"stations":{"masop":[127],"masop2":[0],"ignore_rain":[0],"ignore_sn1":[0],"ignore_sn2":[0],"stn_dis":[0],"stn_seq":[116],"stn_spe":[0],"snames":["Tropfleitung Hecke","Beet Küche","Rasen Küche","Beet Wohnzimmer","Rasen Wohnzimmer","Rasen Büro","Tropfleitung Hecke P","Pumpe"],"maxlen":32}}
user@ubuntuvm:~$ 

I have copied the output as is except for md5 hash of password and the MQTT password. Is it ok that the message "Closing connection 0" is in the middle of the JSON response?

nanosonde avatar Nov 22 '21 17:11 nanosonde

If someone is willing I can hop onto the integration slack channel or hass discord and do an interactive debug session. It seems pretty odd the behavior observed :(

travisghansen avatar Nov 22 '21 17:11 travisghansen

Good news. I was able to solve my issue.

While analysing the OpenSprinkler UI again, I realized that one of the German Umlaut ("ä") was not correctly shown. This seems to be a result of exporting and importing the config file again after upgrading the OSPi firmware to 2.1.9.

I replaced the German Umlaut by its ASCII variant ("ae"). After this change the integration was able to connect and successfully configure itself.

BTW: Only now I have realized that this topic is about [%key:common::config_flow::error::cannot_connect%], but I got this one: [%key:common::config_flow::error::unknown%]

The questions is how to solve this. How can we make it more robust when it comes to "broken" names/string in Opensprinkler FW?

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.opensprinkler.config_flow
Source: custom_components/opensprinkler/config_flow.py:47
Integration: OpenSprinkler (documentation, issues)
First occurred: 07:41:34 (2 occurrences)
Last logged: 07:42:08

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/opensprinkler/config_flow.py", line 47, in async_step_user
    await controller.refresh()
  File "/usr/local/lib/python3.9/site-packages/pyopensprinkler/__init__.py", line 218, in refresh
    await self._refresh_state()
  File "/usr/local/lib/python3.9/site-packages/pyopensprinkler/__init__.py", line 237, in _refresh_state
    content = await self.request("/ja")
  File "/usr/local/lib/python3.9/site-packages/pyopensprinkler/__init__.py", line 145, in request
    content = await self._request_http(url)
  File "/usr/local/lib/python3.9/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/pyopensprinkler/__init__.py", line 191, in _request_http
    content = await resp.json(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1113, in json
    return loads(stripped.decode(encoding))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 700: invalid continuation byte

nanosonde avatar Nov 23 '21 08:11 nanosonde

I had the same issue. Running 2.1.9. I tried everything in the IP feild, and could not make it work. But suddenly, it configured, like on the 15th try. I just wrote HTTP://OS LOCAL IP with no port number, my OS pasword, and left eh MAC adress field blank.

Sleepy81 avatar Nov 28 '21 16:11 Sleepy81

I have solved it now. thanks for the hint. The problem was related to german characters like ä,ö,ü. I substituted with ae, oe and ue.

The only problem left is the fact that switches on haas have no effect. It looks like I have just read access to these entities. Any idea?

Am 28.11.2021 um 17:21 schrieb Sleepy81 @.***>:

I had the same issue. Running 2.1.9. I tried everything in the IP feild, and could not make it work. But suddenly, it configured, like on the 15th try. I just wrote HTTP://OS http://os/ LOCAL IP with no port number, my OS pasword, and left eh MAC adress field blank.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vinteo/hass-opensprinkler/issues/92#issuecomment-981112500, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR5Z3VLPR5HE6BDVUVOCHXLUOJJIXANCNFSM4NPLS5GQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

passi16 avatar Nov 28 '21 16:11 passi16

Which switches exactly?

travisghansen avatar Nov 28 '21 18:11 travisghansen

Valves and programs Best Markus

Am 28.11.2021 um 19:21 schrieb Travis Glenn Hansen @.***>:

 Which switches exactly?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

passi16 avatar Nov 28 '21 21:11 passi16

You toggle the switch and after a few moments it goes back to the original state?

What are your expectations when it is toggled?

travisghansen avatar Nov 28 '21 22:11 travisghansen

The switch shows state on but is off. I would expect the button to show off state and to be able to turn it on for the last defined time.

Best Markus

Am 28.11.2021 um 23:20 schrieb Travis Glenn Hansen @.***>:

 You toggle the switch and after a few moments it goes back to the original state?

What are your expectations when it is toggled?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

passi16 avatar Nov 29 '21 10:11 passi16

The built-in switches do not run the valves/programs, they only enable/disable them. To run a valve/program you must use the services and create your own switches/ui to handle that.

Was that the issue is just a problem with expectations? Or did you create custom switches to invoke the services and those are not working?

travisghansen avatar Nov 29 '21 14:11 travisghansen

I had the same issue. Running 2.1.9. I tried everything in the IP feild, and could not make it work. But suddenly, it configured, like on the 15th try. I just wrote HTTP://OS LOCAL IP with no port number, my OS pasword, and left eh MAC adress field blank.

Also worked for me. HTTP://xxx.xxx.xxx.xxx

helgard999 avatar Feb 10 '22 15:02 helgard999

Just hit this bug, too. Adding a default protocol prefix should be the fix here, but at the very least it should return a more actionable and obvious error message.

shampeon avatar Aug 05 '22 02:08 shampeon