Hi @rattatosk
Great thinking, thanks for the link. Also looking myself for a plugin for HA.
Afaik there’s no API available. But there are multiple ways getting the data:
Did some testing and it seems like the way you could access the Jablotron Web Service is still the same. I’ve attached some python code to try it yourself. Although you could extend this with more functionality like arming and disarming it, the question is how you would keep track of the latest state of the system. The system is not triggering a script, so you should make a loop with a specific request interval retreiving new data every nth second. I’m not sure if Jablotron has a specific rate limit.
Code:
import json
import requests, pickle
username = "[email protected]"
password = "yourpassword"
cookiefile = "jabcookie"
class jablotron():
def _save_cookies(requests_cookiejar, filename):
with open(filename, 'wb') as f:
pickle.dump(requests_cookiejar, f)
def _load_cookies(filename):
with open(filename, 'rb') as f:
return pickle.load(f)
url1 = 'https://www.jablonet.net/ajax/login.php'
payload1 = {'login': username,
'heslo': password,
'aStatus': '200',
'loginType': 'Login'}
data1 = requests.post(url1, data=payload1)
_save_cookies(data1.cookies, cookiefile)
json = json.loads(data1.text)
reload = json['reload']
status = json['status']
if status == 200:
service_id = reload.split('?service=')[1]
url2 = 'https://www.jablonet.net/app/ja100?service=' + service_id
data2 = requests.get(url2, cookies=_load_cookies(cookiefile))
url3 = 'https://www.jablonet.net/app/ja100/ajax/stav.php'
data3 = requests.get(url3, cookies=_load_cookies(cookiefile))
print(data3.text)
else:
print "No valid page, probably got redirected because of wrong password"
Hi @plaksnor
I know this is a fairly old topic, but I just tested the code, and it seems like nothing has changed in terms of the Web service.
I am mainly interested in the Log/History, which is found by replacing the URL3 with https://www.jablonet.net/app/ja100f/ajax/historie.php.
I haven’t worked a lot with Python and HA.
How do you run this code in HA, and where is the “answer” saved?
And regarding where the “answer” (I guess you mean response) is saved: the way the response will be stored depends on the method you choose.
For example, the results of your script or command-line in method 1 or 2 is the state of your sensor. If you choose for a more advanced approach (3rd option), you need to define/initialize them yourself. This can be quite a challenge if you haven’t worked a lot with Python and HA.