Page 1 of 1

How to implement a value from domoticz in python script

Posted: Sunday 07 July 2019 22:29
by jurg1505
I want to pwm a GPIO from a Raspberry pi with a Domoticz dimmer.

I have a python code;

Code: Select all

import RPi.GPIO as GPIO     # Importing RPi library to use the GPIO pins
from time import sleep  # Importing sleep from time library
led_pin = 22            # Initializing the GPIO pin 22 for LED
GPIO.setmode(GPIO.BCM)          # We are using the BCM pin numbering
GPIO.setup(led_pin, GPIO.OUT)   # Declaring pin 22 as output pin
pwm = GPIO.PWM(led_pin, 100)    # Created a PWM object
pwm.start(0)                    # Started PWM at 0% duty cycle
            pwm.ChangeDutyCycle(x) # Change duty cycle
How can i give "x" the value of a Domoticz idx ?