help needed with httpd plugin

Posted on
Fri Dec 30, 2022 9:45 am
marcel langelaan offline
Posts: 65
Joined: May 12, 2017

help needed with httpd plugin

Hello, I need some help to understand what I am doing not correct by using the httpd plugin.
I have installed the httpd including configured a variable httpd_foo.
When I use a browser to sent the following link: http://marcel:1234@192.168.1.50:5555/setvar?foo=bar

The variable is not updated, the following logging is generated

Code: Select all
   HTTPd 2 Debug                   MyRequestHandler: GET to port 5555 from 192.168.1.141:55458 for /setvar?foo=bar
   HTTPd 2 Debug                   MyRequestHandler: Request has no Authorization header:
   HTTPd 2 Debug                   {'accept-language': 'en-GB,en;q=0.9', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'host': '192.168.1.50:5555', 'upgrade-insecure-requests': '1'}
   HTTPd 2 Debug                   MyRequestHandler: GET to port 5555 from 192.168.1.141:55459 for /setvar?foo=bar
   HTTPd 2 Debug                   MyRequestHandler: auth_map = {'username': 'marcel', 'nonce': 'c56225c19bfc37b57345bbb01048f160', 'realm': 'HTTPd Plugin', 'algorithm': 'MD5', 'qop': 'auth', 'cnonce': '10c99fa83d7193a052db9cce594fcfa2', 'nc': '00000001', 'uri': '/setvar?foo=bar', 'response': '88ebb82465c91e48c72dcb4d2bc6173a'}
   HTTPd 2 Debug                   Myrequesthandler: digest authorization valid
   HTTPd 2 Debug                   webhook 5555: MyRequestHandler: updating device
   HTTPd 2 Debug                   webhook 5555: MyRequestHandler: saved_states = {u'foo': u'bar'}
   HTTPd 2 Debug                   webhook 5555: MyRequestHandler: new_states = {'foo': 'bar'}
   HTTPd 2 Debug                   webhook 5555: getDeviceStateList, base state_list = States : (list)
   HTTPd 2 Debug                   webhook 5555: getDeviceStateList, adding String state foo, value bar
   HTTPd 2 Debug                   webhook 5555: getDeviceStateList, final state_list = States : (list)
     Item : (dict)
          Disabled : false (bool)
          Key : foo (string)
          StateLabel : foo (string)
          TriggerLabel : foo (string)
          Type : 150 (integer)
     Item : (dict)
          Disabled : false (bool)
          Key : foo (string)
          StateLabel : foo (string)
          TriggerLabel : foo (string)
          Type : 150 (integer)
   HTTPd 2 Debug                   webhook 5555: didDeviceCommPropertyChange no changes


Please advice what I am missing here, thx in advance
Attachments
Screenshot 2022-12-30 at 16.39.51.png
Screenshot 2022-12-30 at 16.39.51.png (20.83 KiB) Viewed 2483 times

Posted on
Fri Dec 30, 2022 9:59 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: help needed with httpd plugin

My bad. I forgot that changed between the HTTP and HTTP 2 plugins. "setvar" is a misnomer, as it actually sets the values of the custom state in the HTTP2 device, not an Indigo variable. So look at the custom states for that device, and use that to trigger your actions.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Dec 30, 2022 10:00 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: help needed with httpd plugin

That also reminds me I need to update the plugin for Python3, so it doesn't break with the next Indigo release.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Dec 30, 2022 10:23 am
marcel langelaan offline
Posts: 65
Joined: May 12, 2017

Re: help needed with httpd plugin

Great,
Thx its working perfect.

Posted on
Sat Dec 31, 2022 4:53 am
marcel langelaan offline
Posts: 65
Joined: May 12, 2017

Re: help needed with httpd plugin

One additional question,
How is it possible to reset the "custom device" status to a default value after a certain time.
This by an timed trigger and modify the custom device status, but how?
Or via a http:// , but I don't see a solution to arrange this via a trigger, without using a script.

thx in advance

Posted on
Sat Dec 31, 2022 6:58 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: help needed with httpd plugin

No, there's no provision for changing the states except by a webhook call of some kind. What's your use case for that? Maybe I can suggest an alternative.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Dec 31, 2022 7:44 am
marcel langelaan offline
Posts: 65
Joined: May 12, 2017

Re: help needed with httpd plugin

Usages: Foscam VM1 doorbell generates a web hook, which is now changing the status in the httpd attribute => working fine
Unfortunately when its come in rest, it will not update the status => this must be done via Indigodomo.

Current status:
Based on a trigger-timer I sent via python script:
import requests
result = requests.get('http://marcel:1234@192.168.1.50:5555/setvar?doorbell=off')
=> working fine

The issue I have now, that every time a new url is loaded in a new safari tab. Looking for a solution to close safari, which seems very difficult ;)

When you see another solution I am more then open for improvements.

Posted on
Sat Dec 31, 2022 8:30 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: help needed with httpd plugin

So what you're saying is that the doorbell sends a webhook when the button is pressed, but never sends any kind of timeout webhook which could reset the variable?

In that case, enable the timestamp option in the httpd device, and trigger on any change to the timestamp state instead of the doorbell state. And use a condition on the trigger to verify that the doorbell state is correct. Doing it that way eliminates the need for clearing the doorbell state.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Dec 31, 2022 10:25 am
marcel langelaan offline
Posts: 65
Joined: May 12, 2017

Re: help needed with httpd plugin

perfect, thx that will help.

Posted on
Thu Jan 12, 2023 12:55 pm
marcel langelaan offline
Posts: 65
Joined: May 12, 2017

Re: help needed with httpd plugin

Hello,

The plug-in is working fine with a browser, although when I log in for the first time a pop-screen request userid-password although I have included this in the link (http://marcel:1234@192.168.1.50:5555/setvar?doorbell=on). => also without direct login is see in the log that an attempt is performed.
I have configured a Foscam VD1 with this link, which is not picked up by the web hook in Indigodomo. Support from Foscam has come to the conclusion that the URL is not accepted by Indigodomo-webhook. => in the log totally nothing is visible.

On the request how Foscam has tested there functionality the provided me with the following information:
After discussing, we think that your testing environment is blocking the request of our camera.
We suggest you to install Domoticz or make a webcall using ifttt.com to test our camera alarm linkage.
Using Domoticz or making a webcall using ifttt.com is the suggestion.
Foscam R&D team used the HFS.exe to set http server to test our camera alarm linkage feature. Attached is their test.
See attachment log for the Foscams VD1 call.

Do you have suggestions, more then willing to sent you the VD1 so you can make it work.

Thx in advance
Attachments
9311998E-D535-43F5-A3D6-EF0B9E35E56A.png
9311998E-D535-43F5-A3D6-EF0B9E35E56A.png (279.94 KiB) Viewed 2305 times

Posted on
Thu Jan 12, 2023 1:18 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: help needed with httpd plugin

Do this command in a Terminal window and paste the output.

Code: Select all
curl -v "http://marcel:1234@192.168.1.50:5555/setvar?doorbell=on"

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Jan 12, 2023 1:22 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: help needed with httpd plugin

Also, make sure you have debug logging on in the plugin when you do these tests.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Jan 12, 2023 1:42 pm
marcel langelaan offline
Posts: 65
Joined: May 12, 2017

Re: help needed with httpd plugin

Hello,

Terminal server response:
~ % curl -v "http://marcel:1234@192.168.1.50:5555/setvar?doorbell=on"
* Trying 192.168.1.50:5555...
* Connected to 192.168.1.50 (192.168.1.50) port 5555 (#0)
* Server auth using Basic with user 'marcel'
> GET /setvar?doorbell=on HTTP/1.1
> Host: 192.168.1.50:5555
> Authorization: Basic bWFyY2VsOjEyMzQ=
> User-Agent: curl/7.85.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: BaseHTTP/0.3 Python/2.7.18
< Date: Thu, 12 Jan 2023 19:40:40 GMT
< WWW-Authenticate: Digest realm="HTTPd Plugin", nonce="ac6849aac72dfaebda895d527b684e23", algorithm="MD5", qop="auth" Basic realm="HTTPd Plugin"
< Content-type: text/html
<
* Closing connection 0

HTTPD log:
HTTPd 2 Debug MyRequestHandler: GET to port 5555 from 192.168.1.141:64624 for /setvar?doorbell=on
HTTPd 2 Debug MyRequestHandler: auth_map = {'username': 'marcel', 'password': '1234'}
HTTPd 2 Debug Myrequesthandler: basic authorization valid
HTTPd 2 Debug webhook 5555: MyRequestHandler: updating device
HTTPd 2 Debug webhook 5555: MyRequestHandler: saved_states = {u'doorbell': u'on'}
HTTPd 2 Debug webhook 5555: MyRequestHandler: new_states = {'doorbell': 'on'}
HTTPd 2 Debug webhook 5555: getDeviceStateList, base state_list = States : (list)
HTTPd 2 Debug webhook 5555: getDeviceStateList, adding String state doorbell, value on
HTTPd 2 Debug webhook 5555: getDeviceStateList, adding String state http2_timestamp, value 01/12/23 20:40:40
HTTPd 2 Debug webhook 5555: getDeviceStateList, final state_list = States : (list)
Item : (dict)
Disabled : false (bool)
Key : doorbell (string)
StateLabel : doorbell (string)
TriggerLabel : doorbell (string)
Type : 150 (integer)
Item : (dict)
Disabled : false (bool)
Key : doorbell (string)
StateLabel : doorbell (string)
TriggerLabel : doorbell (string)
Type : 150 (integer)
Item : (dict)
Disabled : false (bool)
Key : http2_timestamp (string)
StateLabel : http2_timestamp (string)
TriggerLabel : http2_timestamp (string)
Type : 150 (integer)
Trigger 1 test trigger for doorbell
HTTPd 2 Debug webhook 5555: didDeviceCommPropertyChange no changes
HTTPd 2 Debug webhook 5555: didDeviceCommPropertyChange no changes

Posted on
Thu Jan 12, 2023 2:03 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: help needed with httpd plugin

Well, that tells me the plugin is working, since when you send that webhook using Terminal it all works. So the problem is that something is blocking the Foscam device.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Jan 12, 2023 2:05 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: help needed with httpd plugin

The Foscam is Wifi, right? Is it on your main Wifi network or a Guest or IoT network?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Who is online

Users browsing this forum: No registered users and 14 guests