How to implement a value from domoticz in python script

Python and python framework

Moderator: leecollings

Post Reply
jurg1505
Posts: 8
Joined: Sunday 07 July 2019 22:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

How to implement a value from domoticz in python script

Post 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 ?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest