Python and Blockly Problems Topic is solved

Python and python framework

Moderator: leecollings

Post Reply
daconas
Posts: 17
Joined: Wednesday 22 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Python and Blockly Problems

Post by daconas »

Hello i am new her i use domoticz first on my NAS and now on a Raspberry.
a long time works perfect then i integrate motion and door snsors and try to combine somy events.

Now Domoticz dont work fine first i get problems and then can not connect to domoticz pi is running stable restart nothing helps
i try it on a new card and it works again but the events only with problems

example when device A is triggered turn on device B for 1 Minute that works fine
but with sunrise works some time or ca. 5 sec later not on time

i try many hours and i giv up

i take a new card install jessie lite new pyton2.7 and i start new add rfxcom and take some devices now i have a switch with on/off and only on
is sending when i take push off i can turn off

is the problem python or what is wrong now

i can not use domoticz now
please help me
SweetPants

Re: Python and Blockly Problems

Post by SweetPants »

daconas wrote:Hello i am new her i use domoticz first on my NAS and now on a Raspberry.
a long time works perfect then i integrate motion and door snsors and try to combine somy events.

Now Domoticz dont work fine first i get problems and then can not connect to domoticz pi is running stable restart nothing helps
i try it on a new card and it works again but the events only with problems
Well you gave the answer yourself. It started after adding events, so disable all your evens and try adding them one-by-one and see where it gets unstable.
daconas
Posts: 17
Joined: Wednesday 22 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python and Blockly Problems

Post by daconas »

some events work fine for some weeks there is no problem

now i know the problem is the time
i dont know why

when i try with time or sunset it turn on every minute without error in the protokoll-

how can i turn on a lam with trigger in a specific between a time

i found many examples an i try it but the lamp goes automatic on every minute ( alsow when the trigger is off)

i try many houres i am on the end.
Attachments
2.png
2.png (12.01 KiB) Viewed 3369 times
1.png
1.png (12.08 KiB) Viewed 3369 times
SweetPants

Re: Python and Blockly Problems

Post by SweetPants »

I'm not familiar with Blocky, but, assuming the script is run as a 'time' script, It does exactly what you programmed in Blocky. Between 17:00 and 23:00 the light is turned "on" for 0.3 minutes if it is 'off'. 'time' based scripts run every minute and because you turn "off" the light after 0.3 minutes, it is turned "on" again the next time the script runs.
daconas
Posts: 17
Joined: Wednesday 22 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python and Blockly Problems

Post by daconas »

the Problem is the Motion sensor always give a off state when is triggered

when i use it without time it works perfect but i need it by night ( sunrise or bei time ) but when i set it between a time it turns on every minute but not without time.

what is wrong or what can i do ?
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Python and Blockly Problems

Post by StanHD »

Take a look at the below working Blockly.
Principles:-
The On-Off period for the PIR (FGMS001) is set within the Z-Wave parameters of the node:- 6. Motion Alarm Cancellation Delay: 120.
The "WC Auto" Is adummy switch I have on all my Blockly's to turn them "Off" if required.
The "WC Light = Off" is a vital check to prevent switching regardless of current state.
The "WC actual" is a check for light level so light does not come on if the room is bright.

(The first "Else If" section is only in place as we have different set levels dependent upon time criteria.)

Perhaps you can take something from this that will help you?

https://ibb.co/bTop5k
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
daconas
Posts: 17
Joined: Wednesday 22 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python and Blockly Problems

Post by daconas »

Hello, thank you
looks komplex, i check this

but when i test it with a lamp i turns not on automatic

so i want it with motion sensor

and second pic
i try one with schwitch not motion but nothing happens.
can you explain why pic 3 works but when i use the same with sunset it turn on again and again
when the problem the off state why works without time ?
Attachments
no time.JPG
no time.JPG (18.35 KiB) Viewed 3336 times
motion.JPG
motion.JPG (31.39 KiB) Viewed 3337 times
licht.jpg
licht.jpg (18.14 KiB) Viewed 3337 times
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Python and Blockly Problems

Post by freijn »

This is how I managed to get it to work :

I think it has to do with 2 times AND where you need an OR

Image
daconas
Posts: 17
Joined: Wednesday 22 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python and Blockly Problems

Post by daconas »

ok, but think "or" means either sunriser or sunset ?

i found some exaples but it works not by me
https://gathering.tweakers.net/forum/li ... 1530723/25

ok i try it but it is the same light goes on and off

the problem is when i use time the light goes automatic on without a Trigger.
Attachments
and.png
and.png (49.15 KiB) Viewed 3326 times
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Python and Blockly Problems

Post by freijn »

Now I see your "problem"

Please put the "Spots achtertuin" in a groep.

then in the Groep item hit Timers.

In timers you can configure them to go on and off with sunset and sundown.
Forget the Blocky !!! :-)

Image
daconas
Posts: 17
Joined: Wednesday 22 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python and Blockly Problems

Post by daconas »

ok i try this before but i can onle set groupe in Blockmode not motion an group i trigger and the other is i can only turn on by sunrise or sunset
i have to fix the ...

and why is the option time and sunrise when not possible to use
i try with ohter devices al the same problem

it must be possible to turn on trigger in specific time or not ?
Attachments
groupe.JPG
groupe.JPG (23.12 KiB) Viewed 3311 times
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Python and Blockly Problems

Post by freijn »

Perhaps it is me but can you eaplain ( again ) what you are trying to do ?

the lamp in the garden has to go on if a Pir is triggered and only in the evening ? Correct?
daconas
Posts: 17
Joined: Wednesday 22 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python and Blockly Problems

Post by daconas »

Hello, i want use a Motionsensor ( Aktivate State is off ) to turn on a Lamp after sunset and befor sunrise.

the sensor works but when i use Sunrise or time the lamp goes in on and off loop.
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Python and Blockly Problems

Post by StanHD »

The reason for the "Or" between Sunset and Sunrise is because Domoticz starts a new day at midnight (00:00) therefore it can never be between:-
(Sunset until 00:00) AND (00:00 until Sunrise).
It can be:-
(Sunset until 00:00) OR (00:00 until Sunrise)

Hope that helps
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
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Python and Blockly Problems

Post by freijn »

So build your blocky exactly as my example blocky.
That one works perfectly for your purpose.
daconas
Posts: 17
Joined: Wednesday 22 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python and Blockly Problems

Post by daconas »

@ freijn
you have a Link or pic or you mean the group setting ?

@StanHD
i think about this problem but i try alredy this and the loop starts every new minute
time.png
time.png (13.08 KiB) Viewed 3288 times
but i try this one at Night
time.png
time.png (13.08 KiB) Viewed 3288 times
Thank you
Attachments
state on.png
state on.png (19.17 KiB) Viewed 3288 times
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Python and Blockly Problems

Post by StanHD »

So, after 0.3 minutes what happens to the "Bewegunsmelder Eingang"? .... nothing? .... So it is still off?
But the Mi-Light has now turned off, so a change has been made and thus the conditions are again met such that the "Do" event will be triggered again ..... and again until you are outside the time limits, or the "Bewegunsmelder Eingang" is on where the conditions are not met and the "Do" condition is therefore not carried out. :)
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
daconas
Posts: 17
Joined: Wednesday 22 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python and Blockly Problems

Post by daconas »

hello StanHD
sorry my Englisch is very bad
im not sure what you mean exactly.

First of all i try this
no time.JPG
no time.JPG (18.35 KiB) Viewed 3274 times
an i try the motionsensor i put in on the frontdoor and its working without loop or somthing.

Then i want try to turn on only by night but the loop comes i think about a error in the time in the moment of 00:00 and i try time
sunset to 11:00 pm an 07:00 pm to 11:00 pm but nothing works
i lookt many example but nothing.

now is the lampe quiet i think it is the or between the sunset and sunrise i hope the light goes on when sun goes down and no loop comes.
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Python and Blockly Problems

Post by StanHD »

Do not apologise for your English, I am sure I could not speak any of your language :D

So can you explain about your PIR. Which make / model is it? :)
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
daconas
Posts: 17
Joined: Wednesday 22 March 2017 9:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python and Blockly Problems

Post by daconas »

Hello, now its working with last konfiguration " Sunset or Sunrise"
Thank you to freijn the " or " was right .
Thank you to all for the Help.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest