Ulanzi Smart Pixel Clock
I played with the Ulanzi Smart Pixel Clock and flashed the custom firmware awtrix3
Setup the Smart Pixel Clock e.g. WIFI password, IP of the MQTT broker (the system you will be sending commands from) and update the time zone (e.g. Europe/Berlin = CET-1CEST,M3.5.0,M10.5.0/3()
For details on the MQTT API check this documentation.
Here are some examples with Mosquitto and curl:
Control device using Mosquitto
Start mosquitto
mosquitto -v
Monitor MQTT topics:
mosquitto_sub -h localhost -t "awtrix/#"
Send a message:
mosquitto_pub -h localhost -t "awtrix/notify" -m '{"text":"Hello, Awtrix!","rainbow":true,"duration":10}'
Show a red arrow on the top right corner
mosquitto_pub -h localhost -t "awtrix/indicator1" -m '{"color":[255,0,0],"blink":1000}'
Remove the arrow again:
mosquitto_pub -h localhost -t "awtrix/indicator1" -m '{"color":[0,0,0]}'
Control device using Curl
Same commands as above using curl:
curl -X POST --data '{"color":[0,0,0]}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/indicator1'
curl -X POST --data '{"color":[255,0,0],"blink":1000}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/indicator1'
curl -X POST --data '{"text":"LOL 0xfab1","rainbow":true}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/notify'
curl -X POST --data '{"text":"Hello World"}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/notify'
Now some more examples :)
Simple Notification
curl -X POST --data '{"text":"Hello Awtrix!","duration":10}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/notify'
Rainbow Text Notification
curl -X POST --data '{"text":"Rainbow Notification!","rainbow":true,"duration":15}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/notify'
Set Indicator 1 to Red
curl -X POST --data '{"color":[255,0,0]}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/indicator1'
Blink Indicator 2 with Green
curl -X POST --data '{"color":[0,255,0],"blink":500}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/indicator2'
Fade Indicator 3 with Blue
curl -X POST --data '{"color":[0,0,255],"fade":1000}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/indicator3'
Set Mood Light with Warm Temperature
curl -X POST --data '{"brightness":150,"kelvin":3000}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/moodlight'
Set Mood Light with Custom Color
curl -X POST --data '{"brightness":200,"color":"#FFA500"}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/moodlight'
Disable Mood Light
curl -X POST --data '{}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/moodlight'
Turn Off the Matrix
curl -X POST --data '{"power":false}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/power'
Put Device to Sleep for 30 Seconds
curl -X POST --data '{"sleep":30}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/sleep'
Create a Custom App
curl -X POST --data '{"text":"Custom App Example","icon":1,"duration":10}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/custom?name=myapp'
Update the Custom App
curl -X POST --data '{"text":"Updated App Content!","color":"#00FF00"}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/custom?name=myapp'
Remove the Custom App
curl -X POST --data '{}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/custom?name=myapp'
Draw a Circle and Rectangle
curl -X POST --data '{"draw": [{"dc":[10,10,5,"#FF0000"]}, {"dr":[15,15,10,5,"#00FF00"]}]}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/notify'
Play a Predefined Sound
curl -X POST --data '{"sound":"alarm"}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/sound'
Play an RTTTL Sound String
curl -X POST --data '{"rtttl":"Mario:d=4,o=5,b=140:e6,8e6,8e6,8c6,8e6,8g6"}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/rtttl'
Reboot the Device
curl -X POST -H 'Content-Type: application/json' 'http://1.2.3.4/api/reboot'
Perform a Factory Reset
curl -X POST -H 'Content-Type: application/json' 'http://1.2.3.4/api/erase'
Reset Settings
curl -X POST -H 'Content-Type: application/json' 'http://1.2.3.4/api/resetSettings'
Navigate to Next App
curl -X POST -H 'Content-Type: application/json' 'http://1.2.3.4/api/nextapp'
Switch to a Specific App
curl -X POST --data '{"name":"Time"}' -H 'Content-Type: application/json' 'http://1.2.3.4/api/switch'