The script works when i set the hoek manualy.
When i try to get the value from Domoticz i get syntax error.
The link comes from https://www.domoticz.com/wiki/Mindergas.nl
What am i doing wrong ?
Code: Select all
import json
from jq import jq
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
GPIO.setup(03, GPIO.OUT)
pwm=GPIO.PWM(03, 50)
pwm.start(0)
hoek=`curl -s "http://127.0.0.1:8080/json.htm?type=devices&rid=59" | jq '.result[0].Level'| tr -d '"'`
def SetAngle(angle):
duty = angle / 18 + 2
GPIO.output(03, True)
pwm.ChangeDutyCycle(duty)
sleep(1)
GPIO.output(03, False)
pwm.ChangeDutyCycle(0)
SetAngle(hoek)
pwm.stop()
GPIO.cleanup()