server-rack-led/code.py

22 lines
567 B
Python

import netman
import time
from umqttsimple import MQTTClient
from machine import Pin
from datetime import datetime
from random import *
country = 'DE'
ssid = 'EbbesOPNsense'
password = 'Umpigaming2019'
wifi_connection = netman.connectWiFi(ssid,password,country)
mqtt_server = 'homeassistant.ping-mee.local'
client_id = 'ServerRackLED'
user_t = 'mqtt'
password_t = 'picopassword'
def mqtt_on_connect(client, userdata, flags, rc):
client.subscribe("server-rack-led/power")
client.subscribe("server-rack-led/mode")
client.subscribe("server-rack-led/rgb")