Hello,
I have a text device that gives my the status of my Roomba robot. The status can be "Running", "Stopped" and "End Mission".
I would like to activate a switch based on a status change with blocky.
I would like to achieved the following:
If RoombaS9 State = Running
do set Dummy test = on
I use a Dummy switch now. When I got the script working I will switch the dummy for a group of lights/ switches.
This is what I created in Blocky now. But that isn't working.
I hope someone can help me.
Thank you for your help in advance.
greetz ven
Change a Switch with a text device
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Change a Switch with a text device
According to the tooltip (see below) the block is for assigning a value to a text sensor. You cannot use this block to read the value of a text device. I don't think you can do this in Blockly.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 13
- Joined: Sunday 25 October 2020 14:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Helmond
- Contact:
Re: Change a Switch with a text device
Waaren,
I see we are both Dutchmen. Can we continu in Dutch?
For now I will do it in English.
Is there a way to do what I want in a different way? Beside Blocky?
Thnx
I see we are both Dutchmen. Can we continu in Dutch?
For now I will do it in English.
Is there a way to do what I want in a different way? Beside Blocky?
Thnx
- waltervl
- Posts: 5904
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Change a Switch with a text device
You can ask the plugin writer to make it a selector switch instead of a text widget. Then you can set actions on the state change of switch.
Or you can use DzVents scripting to read the status and switch the dummy (or later your lighting group). A lot of examples in the excellent documentation on the wiki https://www.domoticz.com/wiki/DzVents:_ ... _scripting
Or you can use DzVents scripting to read the status and switch the dummy (or later your lighting group). A lot of examples in the excellent documentation on the wiki https://www.domoticz.com/wiki/DzVents:_ ... _scripting
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Change a Switch with a text device
@Svennie, the forum is international so please continue in English. @walterv already answered the question.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 13
- Joined: Sunday 25 October 2020 14:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Helmond
- Contact:
Re: Change a Switch with a text device
Hello Waltvl,waltervl wrote: ↑Wednesday 27 January 2021 18:56 You can ask the plugin writer to make it a selector switch instead of a text widget. Then you can set actions on the state change of switch.
Or you can use DzVents scripting to read the status and switch the dummy (or later your lighting group). A lot of examples in the excellent documentation on the wiki https://www.domoticz.com/wiki/DzVents:_ ... _scripting
Thank you for your response. Can you give me an example of Dzvents script? That I can use in my case? I'm a Noob in Dzvents. I did read the wiki you mentioned but I couldn't find my answer.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Change a Switch with a text device
Your Blockly converted to a working dzVents script.
Code: Select all
return
{
on =
{
devices =
{
'RoombaS9-State', -- Name of your device
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'Roomba',
},
execute = function(dz, item)
if item.text == 'Running' then
dz.devices('Dummy test').switchOn()
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Change a Switch with a text device
"it's not working" is usually not enough to start looking for a root cause

- did you read the getting started with dzVents ?
___________________________________________________________________________________________________________________________
When not yet familiar with dzVents please start with reading Get started Before implementing (~ 5 minutes). Special attention please for "In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents enabled' is checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."
___________________________________________________________________________________________________________________________ - Did you double check the device names used in the script? They need to be exactly equal to the names on your system
- What do you see in the domoticz log when saving this script as a dzVents event-script
- What do you see in the log when the text in your status device is set to 'Running'
Code: Select all
return
{
on =
{
devices =
{
'RoombaS9-State', -- Name of your device
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'Roomba',
},
execute = function(dz, item)
dz.log(item.name .. 'is now "' .. item.text .. '"', dz.LOG_DEBUG)
if item.text == 'Running' then
dz.devices('Dummy test').switchOn()
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Who is online
Users browsing this forum: No registered users and 1 guest