hi im trying to make appdaemon push message to switch
rgb leds tru mqtt
random numbers are effect_r - solved
but i cant find howt to push it to broker - solved
for now i have
there must be number instead of effect_r and that must work in cycle every 1 minute - still searching for answer
im not familiar with programming
and glad to recive some help.
The documentation for run_in is here. At the bottom of the section, it links to the callback definition, which should be the signature of your callback do_it
import appdaemon.plugins.hass.hassapi as hass
import appdaemon.plugins.mqtt.mqttapi as mqtt
import datetime
import json
class HelloWorld(mqtt.Mqtt, hass.Hass):
def initialize(self):
self.set_namespace('mqtt')
self.run_minutely(self.do_it, datetime.time(0, 0, 0))
self.log("Hello from flipsteram random numbers controller")
def do_it(self, kwargs):
import random
effect_r = random.randint(1, 40)
self.mqtt_publish("lights/ws2801/flipstrip1/in", '{ "effect" : ' + str(effect_r) + '}', qos = 0, retain = True)
self.log(effect_r)
thx u help me a lot , maybe i need to get some object oriented programming course next year ) happy new year and lot of luck and happines for you and WHOLE COMMUNITY