Blockly programming driving me mad
Moderator: leecollings
Blockly programming driving me mad
This blockly event is driving me mad. It's supposed to turn lights on in the morning and evening, and turn them off in between and during night. Differnt times week vs. weekend.
If i activate this all lights turn off and if i manually turns everything on everything turns off again after a short while. Can anyone see any galring mistake I've made... i guessit could be done smarter but this should work (in my head at least).
A quite tall image in this link
https://bertholdsson.com/weekly_schedule.jpg
If i activate this all lights turn off and if i manually turns everything on everything turns off again after a short while. Can anyone see any galring mistake I've made... i guessit could be done smarter but this should work (in my head at least).
A quite tall image in this link
https://bertholdsson.com/weekly_schedule.jpg
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Blockly programming driving me mad
perhaps do a check in the firstrow.. after or before time
If x = on the y off
Or if x off then z on
If x = on the y off
Or if x off then z on
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 113
- Joined: Friday 08 January 2016 12:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly programming driving me mad
I may be missing something, but would it not be easier to put all the lights in a group, and then set timers on that group?
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.
Next: harmony hub.
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.
Next: harmony hub.
-
- Posts: 130
- Joined: Monday 31 October 2016 19:34
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Netherlands
- Contact:
Re: Blockly programming driving me mad
+1 was going to say the same thing! Please use groups and timers for this. Will save you lots of time when adding or removing switches later on.sion wrote:I may be missing something, but would it not be easier to put all the lights in a group, and then set timers on that group?
Hardware
1x Raspberry Pi
1x Razberry Z-Wave
1x RFXtrx433E
1x Toon
1x GoodWe Solarpanels
2x FGSD-002 Smoke Detector
1x FGBS-001 Binaire Sensor (RFID lezer)
7x FGMS-001 Motion Sensor
3x ZW089 Verzonken Deursensor
7x NC Wallplug
&lots of KaKu stuff
1x Raspberry Pi
1x Razberry Z-Wave
1x RFXtrx433E
1x Toon
1x GoodWe Solarpanels
2x FGSD-002 Smoke Detector
1x FGBS-001 Binaire Sensor (RFID lezer)
7x FGMS-001 Motion Sensor
3x ZW089 Verzonken Deursensor
7x NC Wallplug
&lots of KaKu stuff
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Blockly programming driving me mad
Or start scripting, would be much better for stuff like this.
Like check every lights status before sending command instead of just sending commands to all lights.
Like check every lights status before sending command instead of just sending commands to all lights.
Re: Blockly programming driving me mad
Thank you all. i tried your ideas and grouping made it all much more readable but I think I'll go with the scripting path. As i understand i can use Python and that should make it more easy to program .
Thanks
Jörgen
Thanks
Jörgen
-
- Posts: 81
- Joined: Thursday 10 December 2015 0:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.4834
- Location: Netherlands
- Contact:
Re: Blockly programming driving me mad
What I found is, that it's not a good idea to put only days of the week in your if statement, because it makes your event execute every minute, because the if statement is true every time. It's better to make a switch called "Weekday" and a switch called "Weekend" or something. And put a timer on those switches. Then change your blocky to "If weekday = on" or "If weekend = on"
-
- Posts: 113
- Joined: Friday 08 January 2016 12:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly programming driving me mad
You could use one switch, if it's on it's the week, or if it's off it's the weekend. However, as it will always be either one or the other - Will the script not still run every min to check the times?Slinkos wrote:What I found is, that it's not a good idea to put only days of the week in your if statement, because it makes your event execute every minute, because the if statement is true every time. It's better to make a switch called "Weekday" and a switch called "Weekend" or something. And put a timer on those switches. Then change your blocky to "If weekday = on" or "If weekend = on"
Either way will work I guess, but Is there any advantage to using a script rather than a timed group for this? Or just preference.
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.
Next: harmony hub.
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.
Next: harmony hub.
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Blockly programming driving me mad
Why use switches for time related stuff? You know that every added switch requires a little bit extra effort of Domoticz?
If you can base64 decode and json decode in Python maybe my pass2php script can be used.
It passes the lua tables devicechanged, otherdevices, otherdevices_idx and otherdevices_lastupdate to a php page. Could be any language there.
Code: Select all
if(in_array(date('N'),array(1,2,3,4,5))) //Weekday
if(in_array(date('N'),array(6,7))) //Weekend
It passes the lua tables devicechanged, otherdevices, otherdevices_idx and otherdevices_lastupdate to a php page. Could be any language there.
- StanHD
- Posts: 347
- Joined: Friday 12 July 2013 16:09
- Target OS: Windows
- Domoticz version:
- Location: East Sussex, UK
- Contact:
Re: Blockly programming driving me mad
Just going back to the Blockley. Use the timers method and groups and remove the "nested" "If" structure. Now that it is much simplified use "else if" to rebuild. Then I am sure it should work. I have never managed to successfully get a nested "if" structure to work.
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
Re: Blockly programming driving me mad
You keep mentioneing timers, what exactly do you mean with those?
Sorry, but i don't really understan :-/
/J
Sorry, but i don't really understan :-/
/J
- StanHD
- Posts: 347
- Joined: Friday 12 July 2013 16:09
- Target OS: Windows
- Domoticz version:
- Location: East Sussex, UK
- Contact:
Re: Blockly programming driving me mad
If you go into the "Timer" function on a standard switch, you will be able to build a schedule there. Then use the switch state in a script or Blockly as part of an "if" condition.
I use several "Dummy" switches as timers.
I use several "Dummy" switches as timers.
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
-
- Posts: 113
- Joined: Friday 08 January 2016 12:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly programming driving me mad
create a group from the domoticz web interface on the groups / scene page. ( make sure it's a group as you want to turn them off too).shalafi wrote:You keep mentioneing timers, what exactly do you mean with those?
Sorry, but i don't really understan :-/
/J
Add all your lights to this group.
Then on the main page, you will now see the group switch. Under this is a timer button. Next to the log button etc...
click on timer, and it will take you to a schedule page where you can set as many on and off times as you like.
Including specific to the day of the week.
I like the group method. It's easy to add a light to the group later on, and the original timers still stand.
I use something similar - I have all the light turn off in order at the end of the night If we are not home, to simulate some one going around the house "locking up".
You can do this with off delays in the group. ( you wouldn't want this for normal functionality).
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.
Next: harmony hub.
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.
Next: harmony hub.
Re: Blockly programming driving me mad
Wow, this was neat. I had already a couple of groups and putting them on timer was exactly what i needed. Much easier than dragging blocks of blockly for this kind of simple repetive tasks.
Thanks
/J
Thanks
/J
Who is online
Users browsing this forum: No registered users and 1 guest