Hey guys!
Is it possible to trigger a button of a buttons device via api?
Any ideas?
-
[solved]Trigger buttonsdevice via API
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
@leader21 Why not call the rule that is triggered by the button directly ?
Like my projects and help? Consider donating electroneum etnjwAKGPqF6omQWRmpp9u2BPyVDG9VuyRQjNJ1S8yfBdfR9qeUQ46kRy8KS2CNqbpNLRrsgmNW6F2TMzxmZgPrh6KctrkrYbm
-
of course, a good advice
tried it with that
the rule says
if button-wifi370-gruen is pressed then execute "sudo node /home/pi/node-light-wifi370/green.js"
need some more help …
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
It is definatly possible, but i dont know exactly how.
currently with
http://IP:8080/api/device/yamaha/buttonPressed?=yamahascene1
i get an
{ "success": false, "message": "expected param: buttonId" }
so buttonPressed is your tool, but i don’t know how to integrate the id correct in the api get request. But i can say some months ago i had it working
-
try it with
http://username:password@IP:8080/api/device/yamaha/buttonPressed?buttonId=yamahascene1
this works for me!
-
Does anybody know how to trigger a rule directly?
(POST)
/api/execute-action/actionString?string=
This is what I tried but I get a 404
I don’t know if this is correct or I just have problems with the encoding of the string -
@SLiX I tried it with a (PATCH) request and it worked.
(PATCH) /api/rules/myTestRuleId
Then it responded:
{ "success": false, "message": "expected param: rule" }
Then added a JSON body
{"rule": "whatever you want or leave it empty"}
Then it works.
-
The way decribed in https://pimatic.org/api/actions/ with this colon did not work for me it responds with
{ "success": false, "message": "Invalid ruleId: \"null\"" }
Can some expert check and update the docs please?
-
thx@all !! will try later when I’m home.
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
allright! got it to work finally thx again !!
@p4co86 gave the correct link. adapted my link accordingly and its working perfect!
never really cared about api things 'till now.
well yes, somehow there has to be some better documentation on the api for dummies (like me )pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
Hello,
If you need you can use the "HTTP Request Shortcuts"
https://play.google.com/store/apps/details?id=ch.rmy.android.http_shortcuts -
@Heizelmann said:
@SLiX I tried it with a (PATCH) request and it worked.
(PATCH) /api/rules/myTestRuleId
Then it responded:
{ "success": false, "message": "expected param: rule" }
Then added a JSON body
{"rule": "whatever you want or leave it empty"}
Then it works.
Yes, you are right, but this only works if the condition is true.
Took me more than half an hour to solve this.
I got all the time ‘200 - {u’success’: True}’, so I wondered why nothing happend.So Im gonna look into the method described in the docs (with actionString), cause I want to execute rules independent from the condition
e: sweetpi exactly mentioned it here (better had seen that before)
-
@SLiX Can you give an example here how the request for triggering the rule action independent of the rule condition?
-
Yes, tested this few moments ago:
‘in your words’ it is
(POST) /api/execute-action
with body (just the then part of the rule - in my example pushbullet test notification):
{'actionString': 'push message:"test" type:"note"'}