Is this your flow?
If you created this flow, open your saved edit link to add it to your account. You can then manage it whenever you sign in. Adding it to your account replaces the edit link.
⚙️ Script Activation:
The script is active by default, as indicated by active = true.
⏰ Trigger:
The script is triggered when the device "Steam - %Username% Status" changes state.
📝 Logging:
Uses the logging level domoticz.LOG_INFO, with entries marked by "AWTRIX3_STEAM" for easy identification.
🚀 Execution:
When triggered, the script performs the following actions:
🔍 Condition Check:
Checks the new state of the "Steam - %Username% Status" device:
- ✅ Recognized states include:
- In-Game: Fetches the game name from "Steam - %Username% Game Name", or defaults to
"In-game". - Online: Notification displays
"Online". - Offline: Notification displays
"Offline".
- In-Game: Fetches the game name from "Steam - %Username% Game Name", or defaults to
- 🛑 If the state is unrecognized, the script logs a warning and stops further actions.
🔄 Action:
- Sends a JSON payload (state and icon) to the "AWTRIX3 - Send Notification" device:
- ✅ If the AWTRIX3 device is found: The notification is sent.
- 🛑 If the AWTRIX3 device is not found: Logs an error.
More Information:
- Domoticz: www.domoticz.com
- Domoticz AWTRIX3 Plugin: GitHub Repository
- Domoticz Steam Plugin: GitHub Repository
Xj8Yokl0OPpx.json
return {
active = true,
on = {
devices = {
'Steam - Username Status'
}
},
logging = {
level = domoticz.LOG_INFO,
marker = "AWTRIX3_STEAM"
},
execute = function(domoticz, steamStatus)
-- Check the new state of the "Steam Status" switch
local newState = steamStatus.state
domoticz.log("Steam Status changed to: " .. newState, domoticz.LOG_INFO)
-- Define default text and icon
local notificationText = ""
local notificationIcon = 28166 -- Fixed icon ID for all states
if newState == "In-Game" then
local gameNameDevice = domoticz.devices('Steam - Username Game Name')
if gameNameDevice and gameNameDevice.text and gameNameDevice.text ~= "" then
notificationText = "Playing: " .. gameNameDevice.text
domoticz.log("Fetched game name: " .. gameNameDevice.text, domoticz.LOG_INFO)
else
notificationText = "In-game"
domoticz.log("No game name found in Steam Game Name device", domoticz.LOG_WARNING)
end
elseif newState == "Online" then
notificationText = "Online"
elseif newState == "Offline" then
notificationText = "Offline"
else
domoticz.log("Unhandled state: " .. newState, domoticz.LOG_WARNING)
return
end
-- Format the JSON payload for AWTRIX3
local payload = {
text = notificationText,
icon = notificationIcon
}
local payloadJSON = domoticz.utils.toJSON(payload)
domoticz.log("Sending to AWTRIX3: " .. payloadJSON, domoticz.LOG_INFO)
-- Send the JSON to the AWTRIX3 "Send Notification App" device
local awtrixDevice = domoticz.devices('AWTRIX3 - Send Notification')
if awtrixDevice then
awtrixDevice.setDescription(payloadJSON)
awtrixDevice.switchOn().afterSec(2)
else
domoticz.log("AWTRIX3 - Send Notification device not found", domoticz.LOG_ERROR)
end
end
}