redcam wrote:Hello,
Everything working fine here, calendar is read, text device showing events, etc...
The only point is how do you name your blocky events in domoticz then how do you write them to your calendar.
I've made an event just like the one you gave as example. If GCAL calendar device = on then log "blablabla" and named that domoticz event as "TEST". Shall i active it ? Do i need to write an "TEST=on" or "TEST {ON}" in google calendar ?
You said instead of Blocky you can script. Can I launch a LUA device trigger event. Got a script in LUA folder named script_device_confort.lua if I write in google calendar confort = On nothing happened. But if i switch my virtual device confort on then script_device_confort.lua is run. So which event shall i write in google calendar to make BGCD launch my script or at least switch on my device.
Thx in advance.
Hi @redcam
It's a bit out of the scope for this topic but You need to activate a Blockly event before it actually does anything. You can name Your Blockly event to whatever you wish, the name won't affect the function of BGCD.
You don't need to write anything special in your Google Calendar. In Domoticz you will trigger your scripts on the
Calendar Device which is actually a switch. The
Calendar Device will be either "On" or "Off" depending on if there is an active calendar event. For Domoticz, the
Calendar Device is just a normal light switch.
Below is an example of a simple lua device script using a
Calendar Device to turn a block heater on or off. The script can be named script_device_XXXXXXX.lua where you can replace XXXXXX to something suitable. Put Your device scripts in the /home/pi/domoticz/scripts/lua folder.
In the script, you need to replace "GCal MYCALENDARNAME" to match whatever you named your
Calendar Device
Code: Select all
-- script_device_test.lua
commandArray = {}
-- In the example below we check if the "Calendar Device" switched
if (devicechanged['GCal MYCALENDARNAME']) then
if (devicechanged['GCal MYCALENDARNAME'] == "On") then
print("The Calendar device was switched on")
commandArray["My Block Heater"] = "On"
end
if (devicechanged['GCal MYCALENDARNAME'] == "Off") then
print("The Calendar device was switched off")
commandArray["My Block Heater"] = "Off"
end
end
return commandArray
If You are not used to Lua scripting I recommend that you try Blockly first. With Blockly You will probably be able to define all the logic You need.
Is that an answer to your question @redcam?