Turn Light On Topic is solved

Post Reply
Padster
Posts: 20
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Turn Light On

Post by Padster » Wednesday 21 June 2017 11:50

Hi,

I have a number of 'Light' devices. I can turn the light on and off manually by clicking the 'bulb' icon on the device. However if I am creating a Blockly script and use the 'Logic' 'Set' statement to set the device to 'On' it won't turn the light on. If I create a scene or group with the light device I can turn it on using the scene/group set statement.

Am I supposed to be able to turn a light on using the Logic 'Set' statement? If yes any idea why its not working?

User avatar
StanHD
Posts: 533
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Turn Light On

Post by StanHD » Wednesday 21 June 2017 11:55

Should work, here is an example that works:-

Image

Can you show your Blockly?
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, Broadlink RM2, HA-Bridge with Amazon Echo / Alexa.

Padster
Posts: 20
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster » Wednesday 21 June 2017 12:06

Hi,

Here is the test Blockly - very simple
lamp.JPG
lamp.JPG (18.52 KiB) Viewed 1039 times
Here are the current states
variables.JPG
variables.JPG (56.48 KiB) Viewed 1039 times
The lamp stays off.

My Domoticz info is;

Version: 3.5877
Build Hash: 15b013c
Compile Date: 2016-11-10 15:44:33

User avatar
tommit01
Posts: 328
Joined: Friday 12 July 2013 14:08
Target OS: Raspberry Pi
Domoticz version: multiple
Location: Germany / SL
Contact:

Re: Turn Light On

Post by tommit01 » Wednesday 21 June 2017 12:55

Hi, please
try to use 'On' tile from blockly category 'Logic' instead of string tile and test it again....

P.S.:
I still don't know why this is still called Blocky ... in so many posts ..it is 'Blockly'

BR
Tommit
1 x RPi3
4 x RPI
3 x RPi2
1 x RPI2 + Win 10 IoT (experimental device)
2 x RPI2 Raspbian "Jessie" + Domoticz (for tenants)
2 x RPI OSMC @ 1GHz
1 RPi Zero W + Cam NOIR
1 RPi Zero W + Cam
RFXtrx 433 FW 1015
RFXtrx 433 E FW 1020

User avatar
heggink
Posts: 303
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V3.7067
Location: NL
Contact:

Re: Turn Light On

Post by heggink » Wednesday 21 June 2017 13:00

Indeed. Unlike lua, switch devices need a state, not a string indicating the state.
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

Padster
Posts: 20
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster » Wednesday 21 June 2017 13:04

Yep - thanks guys that sorted it.

Hobbybob
Posts: 62
Joined: Monday 01 May 2017 19:03
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Turn Light On

Post by Hobbybob » Wednesday 21 June 2017 13:12

tommit01 wrote:Hi, please
P.S.:
I still don't know why this is still called Blocky ... in so many posts ..it is 'Blockly'
Hahaha, even this forum is called Blocky. I've always thought it was Blocky, never noticed the additional L

Padster
Posts: 20
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster » Wednesday 21 June 2017 13:21

Hi Guys,

A couple of follow up questions.

Although the Blockly below works - should I be using the switch states rather than a string?
Capture.JPG
Capture.JPG (62.53 KiB) Viewed 1006 times
Also in StanHD's post in this thread his 'and' condition allows for two lines thus making the test format neater. I can only see an inline 'and' condition. How can I format my Blockly's like StanHD?

User avatar
StanHD
Posts: 533
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Turn Light On

Post by StanHD » Wednesday 21 June 2017 13:58

Also in StanHD's post in this thread his 'and' condition allows for two lines thus making the test format neater. I can only see an inline 'and' condition. How can I format my Blockly's like StanHD?
Right Click on the "And" block, then select "External Inputs" ;)
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, Broadlink RM2, HA-Bridge with Amazon Echo / Alexa.

Padster
Posts: 20
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster » Wednesday 21 June 2017 14:02

Many thanks - I didn't even know you could right click on the Blockly elements.

User avatar
StanHD
Posts: 533
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Turn Light On

Post by StanHD » Wednesday 21 June 2017 14:03

See working Blockly below. No strings :)
Image
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, Broadlink RM2, HA-Bridge with Amazon Echo / Alexa.

Padster
Posts: 20
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster » Wednesday 21 June 2017 14:17

See if I've got this right :)

It the LR PIR is on AND (LR Lights Auto=on AND LR Updown Light=off)
AND
Living Room < 100
SET Updown Lights Level= 5%

I need to learn Blockly better than I have.

Would this smoke/heat detection work?
Basically if any of the smoke or heat detectors are ON then Set Smoke_Alarm variable to 'On', turn the Alarm Lights On and send a notification.

Else

If all the Heat and smoke sensors are Off set the variable Smoke_Alarm to 'Off' after 6 mins
smoke.JPG
smoke.JPG (51.88 KiB) Viewed 972 times

User avatar
StanHD
Posts: 533
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Turn Light On

Post by StanHD » Wednesday 21 June 2017 15:48

Yes the interpretation of my Blockly is correct :)

Regarding your Blockly, it looks OK to me, however I always use numbers in user variables, but that's just me. Perhaps you could mock something up with some dummy switches to test?
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, Broadlink RM2, HA-Bridge with Amazon Echo / Alexa.

Padster
Posts: 20
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster » Wednesday 21 June 2017 16:23

Thanks again.

My Blockly did work when the 'AND' and 'OR' conditions were all inline. Just not sure is nesting them changed the interpretation. I know the order of evaluation is important.

I'll press the smoke alarm test when I get home.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests