Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http plugin URL transformation (documentation suggestion & one question) #141

Closed
WetwareLabs opened this issue Jul 8, 2015 · 2 comments
Closed
Labels

Comments

@WetwareLabs
Copy link

Hi!

I scratched my head for a while when trying to figure out how to embed the payload to the http URL request, but finally figured out it after browsing the code.

For example if I wanted to catch messages such as
mosquitto_pub -t home/zwave/Device20/switch/set -m 1234
and convert it to HTTP request:
http://192.168.1.80:8083/ZWaveAPI/Run/devices[21].instances[0].Basic.Set(1234)

With target:

[#]
targets = {
        'home/zwave/Device20/switch/set' : 'http:dev20set',
        'home/zwave/Device21/switch/set' : 'http:dev21set'
        }

.. and http config:

[config:http]
timeout = 60

targets = {
                #method     #URL               # query params or None          # list auth
  'dev20set'    : [ "post", "http://192.168.1.80:8083/ZWaveAPI/Run/devices[20].instances[0].Basic.Set({payload})", None, None ],
  'dev21set'    : [ "post", "http://192.168.1.80:8083/ZWaveAPI/Run/devices[21].instances[0].Basic.Set({payload})", None, None ]
  }

.. this could be done, but it wasn't quite obvious reading the manual :) Could you add this (or similar) example there?

Also, what I yet haven't figured out is referring to topic (or parts of topic) at the HTTP section.
For example if I had lots of similar devices, I could want to catch all the relevant messages
'home/zwave/Device/+/switch/set' : 'http:devset'
and mangle the URL like this:

'devset'    : [ "post", "http://192.168.1.80:8083/ZWaveAPI/Run/devices[{index_#4_of_the_topic}].instances[0].Basic.Set({payload})", None, None ] 

But how?

Anyway, thanks for the great work!

@amotl
Copy link
Member

amotl commented Nov 20, 2019

Dear @WetwareLabs,

thanks for writing in, happy you made it almost through.

Also, what I yet haven't figured out is referring to topic (or parts of topic) at the HTTP section.

May I humbly ask whether the proposal raised through #303 by @jpmens would actually fit your bill here? It feels similar, however I might be on a total different path here.

With kind regards,
Andreas.

@amotl amotl added the question label Dec 17, 2019
@jpmens
Copy link
Collaborator

jpmens commented Jan 13, 2020

Closing as stale.

@jpmens jpmens closed this as completed Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants