First things first, I'm using a RaspberryPi 3 with Domoticz version 3.8153. And Raspbian version: 4.14.34-v7.
This is my server.
I'm sending from another Pi same type en Raspian version.
Using this script:
Code: Select all
#!/usr/bin/python
import serial
import urllib2
ser = serial.Serial('/dev/ttyACM0',9600)
read_serial=ser.readline()
serverIP = "10.0.0.8:8080"
deviceId = 126
try:
urllib2.urlopen("http://" + serverIP + "/json.htm?type=command¶m=udevice&idx=" + str(deviceId) + "&svalue=" + str(read_serial), timeout=1)
print "Data sent!"
except:
print "Error"
I have tried the suggestion on the wiki.
http://<username:password@>domoticz-ip<:port>/json.htm?api-call
http://<username:password@>domoticz-ip<:port>/json.htm?api-call (username and password encoded using base64)
http://domoticz-ip<:port>/json.htm?username=MkE=&password=OVM=&api-call (username and password encoded using base64)
Not one of these work for me. Most of them give the error 401 Unauthorized. I tried using the curl command and pasting the url in my webbrowser google chrome.
Help would be appreciated.
Edit:
I think that I found the problem with the json commands. I made a separate user for sending the json commands, that was the problem. Apparently you have to use the credentials that are in the settings menu under website protection (see picture).