Turn Light On Topic is solved

Moderator: leecollings

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

Turn Light On

Post by Padster »

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: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Turn Light On

Post by StanHD »

Should work, here is an example that works:-

Image

Can you show your Blockly?
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
Padster
Posts: 21
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster »

Hi,

Here is the test Blockly - very simple
lamp.JPG
lamp.JPG (18.52 KiB) Viewed 5029 times
Here are the current states
variables.JPG
variables.JPG (56.48 KiB) Viewed 5029 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: 39
Joined: Friday 12 July 2013 14:08
Target OS: Raspberry Pi / ODroid
Domoticz version: multiple
Location: Germany / SL
Contact:

Re: Turn Light On

Post by tommit01 »

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: 978
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: Turn Light On

Post by heggink »

Indeed. Unlike lua, switch devices need a state, not a string indicating the state.
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
Padster
Posts: 21
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster »

Yep - thanks guys that sorted it.
Hobbybob

Re: Turn Light On

Post by Hobbybob »

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: 21
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster »

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 4996 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: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Turn Light On

Post by StanHD »

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" ;)
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
Padster
Posts: 21
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster »

Many thanks - I didn't even know you could right click on the Blockly elements.
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Turn Light On

Post by StanHD »

See working Blockly below. No strings :)
Image
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
Padster
Posts: 21
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster »

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 4962 times
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Turn Light On

Post by StanHD »

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?
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
Padster
Posts: 21
Joined: Friday 26 May 2017 20:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Turn Light On

Post by Padster »

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 1 guest