Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tradfri/blixt.py & tradfri/blixt2.py & tradfri/blixt3.py &
- blixt.py:
- #!/usr/bin/env python3
- import sys
- import time
- from credentials import ip, key
- from pytradfri import Gateway
- from pytradfri.api.libcoap_api import api_factory
- api = api_factory(ip, key)
- gateway = Gateway()
- devices_command = gateway.get_devices()
- devices_commands = api(devices_command)
- devices = api(*devices_commands)
- lights = [dev for dev in devices if dev.has_light_control]
- for l in lights:
- if (l.name == 'm1b'):
- light=l
- f=7
- p=1/f
- time.sleep (5.0)
- for i in range (0,181):
- dim_command = light.light_control.set_dimmer(254)
- api(dim_command)
- time.sleep (p/2*0.25)
- dim_command = light.light_control.set_dimmer(0)
- api(dim_command)
- time.sleep (p/2*0.75)
- dim_command = light.light_control.set_dimmer(254)
- api(dim_command)
- blixt2.py:
- #!/usr/bin/env python3
- import sys
- import time
- from credentials import ip, key
- from pytradfri import Gateway
- from pytradfri.api.libcoap_api import api_factory
- api = api_factory(ip, key)
- gateway = Gateway()
- devices_command = gateway.get_devices()
- devices_commands = api(devices_command)
- devices = api(*devices_commands)
- lights = [dev for dev in devices if dev.has_light_control]
- for l in lights:
- if (l.name == 'm1a'):
- light=l
- f=3
- p=1/f
- time.sleep (5.0)
- for i in range (0,95):
- dim_command = light.light_control.set_dimmer(254)
- api(dim_command)
- time.sleep (p/2*0.25)
- dim_command = light.light_control.set_dimmer(0)
- api(dim_command)
- time.sleep (p/2*0.75)
- dim_command = light.light_control.set_dimmer(254)
- api(dim_command)
- blixt3.py:
- #!/usr/bin/env python3
- import sys
- import time
- from credentials import ip, key
- from pytradfri import Gateway
- from pytradfri.api.libcoap_api import api_factory
- api = api_factory(ip, key)
- gateway = Gateway()
- devices_command = gateway.get_devices()
- devices_commands = api(devices_command)
- devices = api(*devices_commands)
- lights = [dev for dev in devices if dev.has_light_control]
- for l in lights:
- if (l.name == 'm1c'):
- light=l
- f=11
- p=1/f
- time.sleep (5.0)
- for i in range (0,120):
- dim_command = light.light_control.set_dimmer(254)
- api(dim_command)
- time.sleep (p/2*0.25)
- dim_command = light.light_control.set_dimmer(0)
- api(dim_command)
- time.sleep (p/2*0.75)
- dim_command = light.light_control.set_dimmer(254)
- api(dim_command)
Advertisement
Add Comment
Please, Sign In to add comment