Page 13 of 16

Re: Events system feedback thread

Posted: Tuesday 28 January 2014 19:21
by Tom23
Hello,
First, sorry for my english, but i'm french.

I'm trying to make a lua time script to do twitter notification with the line command client TTytter.
When i launch manually a script like this:

Code: Select all

commandArray = {}
t1 = os.date("%M")
t2 = t1
if t2 <= "57" then os.execute('/home/pi/ttytter/ttytter -status="test"')
--os.execute('sudo killall TTYtter')
print("Tweet envoye "..t1)
end
It's works fine and the message is post. But when domoticz launch the same script automatically, the ttytter's process run on 100%, dont post and dont stop. I must kill the process.
In the process list in htop i see two process:
-ttytter
-/home/pi/ttytter/ttytter -status="test"
I don't if it's normal.

Can you help me ?

Re: Events system feedback thread

Posted: Tuesday 11 February 2014 20:51
by Yihaaa
I am trying to set up an event for automatic switching on some lights in my living room. I want when I enter the room between 06:00 and upto sunrise three lamps to go on. They have to switch on and stay on until it is sunrise.

But somehow it doesn't work, does somebody know what is wrong and how to correct this?

Re: Events system feedback thread

Posted: Tuesday 11 February 2014 21:29
by CopyCatz
You can only do on for x minutes. How on earth is the system going to make sense of "sunrise minutes"?

Re: Events system feedback thread

Posted: Tuesday 11 February 2014 22:00
by Yihaaa
Well I thought so actually, and hoped the system was kind of smart to know this.
Some other ideas to make sure that the lights are only switched on in the described time frame? And go off when sun rises?

Re: Events system feedback thread

Posted: Tuesday 11 February 2014 22:15
by CodeItAway
I am trying to set the setpoint temperature on a OTGW using a blockly script but i keep getting a: Malformed action sequence! in the logs.
What am I doing wrong?
thermostat.PNG
thermostat.PNG (6.08 KiB) Viewed 13005 times
I also tried setting the value in a LUA script, but that isn't working either (with no errors).

Blocky problem

Posted: Sunday 16 February 2014 16:18
by ace2
I have a problem i have a switch that i always will have on,
Lets say the power go off then it shud turn this switch on even if i accidently turnd it off shall it turn it self on.
How do i do that whit blocky ?

Re: Blocky problem

Posted: Sunday 16 February 2014 16:25
by SweetPants
Hmm, don't know if this is possible with Blockly
You can use 2 LUA scripts to do this.

script_time_always_on.lua (called every 60 sec) will turn on your light after start of domoticz

commandArray = {}
if (otherdevices['Lamp_2_Woonkamer'] == 'Off') then
commandArray['Lamp_2_Woonkamer'] = 'On'
end
return commandArray

script_device_always_on.lua (after device change) will turn your light on again if you turn if off

commandArray = {}
if (devicechanged['Lamp_2_Woonkamer'] == 'Off') then
commandArray['Lamp_2_Woonkamer'] = 'On'
end
return commandArray

Harry

Re: Blocky problem

Posted: Sunday 16 February 2014 16:28
by mbliek
It's not a problem. Just a question about how to do. Merged with the events feedback thread.

Re: Events system thread (questions and feedback)

Posted: Sunday 16 February 2014 18:55
by ace2
That was a nice one SweetPants. Thanks for that
But if i whil send a "on" comand every 10 min ?

Re: Events system thread (questions and feedback)

Posted: Monday 03 March 2014 0:56
by gabou14
Hi !

I'd like to use external text to speech notification in the events using the blockly interface, but everytime I add a space in the url of the openURL action, it doesn't work.
I also tried with the characters encoded (%20), it does not seem to work either.

Am I doing something wrong ?

Thank ou very much !

Re: Events system thread (questions and feedback)

Posted: Friday 02 May 2014 19:35
by simonrg
I think you need commandArray['UpdateDevice'] = ..... you can find an example of its usage for energy logging in the Wiki here - http://www.domoticz.com/wiki/Capturing_ ... ua_Scripts - commandArray['UpdateDevice'] = id .. "|0|" .. power .. ";" .. energy, not sure about exact format for humidity and temperature, but knowing the humidity and temperature ids I guess it should be a matter of just writting the values back to them.

Re: Events system thread (questions and feedback)

Posted: Friday 02 May 2014 22:23
by simonrg
Using commandArray['UpdateDevice'] to update the value, updates the device, so yes this modifies the otherdevices_lastupdate to the time / date at which the update occurs.

Re: Events system thread (questions and feedback)

Posted: Friday 02 May 2014 23:52
by simonrg
Strange, as you say for humidity this does not seem to work correctly as it does for energy meters.

I created a dummy humidity device 'DummyHumidity', then wrote a simple time test script - checking the web humidity display all seems to work fine, the humidity is change to 32% as set with 1 being it is comfortable, the last updated is always less than 1 minute ago as the time script is executed every minute and the devices pages shows the updated time.

However in the script I have 3 issues:
1. otherdevices_humidity['DummyHumidity'] returns nil, not the humidity value, what am I doing wrong?
2. otherdevices_svalues['DummyHumidity'] returns 50% always
3. otherdevices_lastupdate['DummyHumidity'] does not change and so is a time unrelated to that displayed on the web page.

Code: Select all

-- ~/domoticz/scripts/lua/device_time_humidity.lua
commandArray = {}

print('Humidity Script')
hum4 = otherdevices_svalues['DummyHumidity']
-- hum4 = otherdevices_humidity['DummyHumidity']
print('Humidity '..hum4)
print(otherdevices_lastupdate['DummyHumidity'])
commandArray[1] = {['UpdateDevice'] = 417 .. "|32|" .. 1}

return commandArray

Re: Events system thread (questions and feedback)

Posted: Wednesday 07 May 2014 20:24
by simonrg
Without devicechanged_lastupdate ['devicename'], you can use a dummy switch which you switch on at the end of the script each time the script is called. Then before setting the switch you can use otherdevices_lastupdate ['dummy switch'] and so work out the time since the last switching. Have a look at http://www.domoticz.com/wiki/Capturing_ ... ua_Scripts where this concept is used to calculate energy used from power measurements.

Re: Events system thread (questions and feedback)

Posted: Wednesday 25 June 2014 15:22
by panosnl
Hi I just discovered the event interface and it is great.

I seem to have discovered a bug though:

When a block is disbled it gets nicely greyed out. However this block is still executed.

So the only way to diable a block is to completerly remov it.

Running v 1.1811 on raspberry

Re: Events system thread (questions and feedback)

Posted: Tuesday 22 July 2014 7:51
by epierre
Hello,

I have a virtual sensor for Pressure (Pressure type, not the composite Weatherunderground).

Using either otherdevices_barometer[Barometer] or otherdevices[Barometer] does not brings anything, any idea ? data are in the nvalue column...

Re: Events system thread (questions and feedback)

Posted: Friday 15 August 2014 20:44
by leby
Not sure if I should post in this or in the variable part but the challenge is a mix..

To avoid duplicate messages being sent in a PIR scenario I tried to set up a variable instead of a switch to block new event from triggering for x minutes. I realise that it will work with a switch but the variable would be e neater solution.

I have done a simplified scenario to show my question:
blockly.PNG
blockly.PNG (9.26 KiB) Viewed 12780 times
Now I would expect when triggered by the test switch that the variable would first be set to "1" and after 2 minutes be set to "0". unfortunately the second do never happens, if it would work this would be a very handy tool.
var.PNG
var.PNG (1.72 KiB) Viewed 12780 times
Should this work or have I used the blocks incorrect?

Re: Events system thread (questions and feedback)

Posted: Friday 15 August 2014 21:35
by CopyCatz
that doesn't work.

Re: Events system thread (questions and feedback)

Posted: Friday 15 August 2014 22:23
by leby
To bad, guess that I can't use a string variable either with On and Off as alternative, I'll use a dummy switch instead or a script
thx for the info anyhow

Re: Events system thread (questions and feedback)

Posted: Thursday 04 September 2014 21:39
by epierre
Hello,

Is there a way to read the CO2 value ? otherdevices and _svalues does not report anything...

And more globally is it possible to have an otherdevices_nvalues[] in LUA so we could get all devices values with one or the other ?

thanks !