
As for the answer to the original question, it worked! Thanks!

Code: Select all
foo=eg.plugins.HTTPRequest.sendRequest(u'192.168.0.1:56565', uri=u'/devices')
if foo != 200:
eg.StopMacro()
eg.Exit()
content = foo.content
print content
Code: Select all
class RemoteCodes:
direction_up = 'Some remote code here'
eg.globals.remote_codes = RemoteCodes
Code: Select all
eventghost -event Send.RemoteCode eg.globals.remote_codes.direction_up
in a word. Google. in another word Boolean. search for it. learn how to use google to narrow what you are looking for. You can ask me anything you like (programming related, all other questions meh... possibly I will answer). I do not have that "programmer god complex" I started exactly the same as you. and in fact I am still a lousy programmer. but that does not stop me.
that is how every programmer gets started. you learn by reading, using and modifying. you learn how things work that way. I have spend thousands of hours doing this. and in fact I still do it. Why reinvent the wheel? if someone has already key up some code that works and they posted it on the internet. then use it! if you do not understand how it works then tinker around a bit and figure it out. But why spend time writing and debugging when someone else has done this already??? You may need to modify it to add you coding style to it but use what works.
who hasn't?
there is only one thing i can say to this.
Any help would be appreciated.Error in Action: "HTTPRequest: Send HTTP request"
Traceback (most recent call last) (1722):
File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
return self(*args)
File "C:\Program Files (x86)\EventGhost\plugins\HTTPRequest\__init__.py", line 54, in __call__
"{}://{}{}".format("https" if ssl else "http", host, uri),
ValueError: zero length field name in format
Code: Select all
import requests
import json
headers = {
"Authorization": "Bearer ABCDEFGH",
"Content-Type": "application/json"
}
data= {
"entity_id": "switch.christmas_lights"
}
requests.post("http://localhost:8123/api/services/switch/turn_on", headers=headers, data=json.dumps(data))
For those playing along at home, you need to generate a token, not use your password, as per here: https://developers.home-assistant.io/do ... _api_rest/ and keep the Bearer bit, if that was unclear.