Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum .
Moderators: leecollings , remb0
Raspberry Piet
Posts: 158 Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:
Post
by Raspberry Piet » Monday 16 May 2016 21:26
This is what i made so far from the examples.
(i also speak better russian than lua)
Code: Select all
x = tonumber(uservariables['Tag_Green'])
commandArray = {}
if ( uservariables["Tag_Green"] ~= "AWAY" ) and (otherdevices["TAG"]=='Off') then
print('<b style="color:#0099FF">Tag_Green AANWEZIG RSSI:'..x .. ' dBm</b>')
commandArray['TAG']='On'
elseif ( uservariables["Tag_Green"] == "AWAY" ) and (otherdevices["TAG"]=='On') then
print('<b style="color:Red">Tag_Green AFWEZIG</b>')
commandArray['TAG']='Off'
elseif ( uservariables["Tag_Green"] ~= "AWAY" ) then
print('<b style="color:#0099FF">Tag_Green AANWEZIG RSSI:'..x .. ' dBm</b>')
commandArray['UpdateDevice']='2606|0|'..tostring(uservariables['Tag_Green'])
end
if ( uservariables["Tag_Green"] ~= "AWAY" ) and tonumber(x) <= -68 and tonumber(x) >= -76 then
print('<b style="color:#0099FF">Tag_Green EETKAMER RSSI:'..x .. ' dBm</b>')
end
if ( uservariables["Tag_Green"] ~= "AWAY" ) and tonumber(x) <= -77 and tonumber(x) >= -87 then
print('<b style="color:#0099FF">Tag_Green WOONKAMER RSSI:'..x .. ' dBm</b>')
end
return commandArray
Last edited by
Raspberry Piet on Monday 16 May 2016 21:53, edited 1 time in total.
jvdz
Posts: 2189 Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:
Post
by jvdz » Monday 16 May 2016 21:30
What is the result in the log when you use this code? It will show the current processed info:
Code: Select all
commandArray = {}
for variableName, variableValue in pairs(uservariablechanged) do
print("variableName:", variableName, " variableValue:", variableValue)
if (variableName == 'Zhenya_SitRm') then
if tonumber(variableValue) <= -51 and tonumber(variableValue) >= -71 then
commandArray['ZSitRoomBT'] = "On"
end
end
if (variableName == 'Zhenya_SitRm') then
if variableValue == "AWAY" then
commandArray['ZSitRoomBT'] = "Off"
end
end
end
return commandArray
ps. what is the name of the script you use?
Jos
woody4165
Posts: 476 Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:
Post
by woody4165 » Monday 16 May 2016 21:32
Thanks
I understand that you have an uservariable that is updated by the script.
The you have a switch, TAG, that is updated within this script.
What is doing this?
Code: Select all
commandArray['UpdateDevice']='2606|0|'..tostring(uservariables['Tag_Green'])
Is it an uservariable event driven or device driven?
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
Raspberry Piet
Posts: 158 Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:
Post
by Raspberry Piet » Monday 16 May 2016 21:41
woody4165 wrote: Thanks
I understand that you have an uservariable that is updated by the script.
The you have a switch, TAG, that is updated within this script.
What is doing this?
Code: Select all
commandArray['UpdateDevice']='2606|0|'..tostring(uservariables['Tag_Green'])
Is it an uservariable event driven or device driven?
I put the RSSI value in a virtual custom sensor (idx2606) for graph.
jmleglise
Posts: 192 Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:
Post
by jmleglise » Monday 16 May 2016 21:42
Raspberry Piet wrote: It is possible with the Nut app to make the Nut Beacon beep (find keys when lost), is it somehow possible to do the same through a script?
What this has to do with Domoticz ? What is the use case ?
blackdog65
Posts: 311 Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Norfolk, UK
Contact:
Post
by blackdog65 » Monday 16 May 2016 21:44
Hi Jos
I get
Code: Select all
2016-05-16 20:39:35.105 LUA: variableName:
2016-05-16 20:39:35.105 LUA: Zhenya_SitRm
2016-05-16 20:39:35.105 LUA: variableValue:
2016-05-16 20:39:35.105 LUA: -79
2016-05-16 20:39:36.086 LUA: variableName:
2016-05-16 20:39:36.087 LUA: Sean_Hall
2016-05-16 20:39:36.087 LUA: variableValue:
2016-05-16 20:39:36.087 LUA: -79
2016-05-16 20:39:36.115 LUA: variableName:
2016-05-16 20:39:36.115 LUA: Sean_SitRm
2016-05-16 20:39:36.115 LUA: variableValue:
2016-05-16 20:39:36.115 LUA: -80
2016-05-16 20:39:38.947 LUA: variableName:
2016-05-16 20:39:38.948 LUA: Zhenya_SitRm
2016-05-16 20:39:38.948 LUA: variableValue:
2016-05-16 20:39:38.948 LUA: -78
2016-05-16 20:39:38.979 LUA: variableName:
2016-05-16 20:39:38.980 LUA: Zhenya_Hall
2016-05-16 20:39:38.980 LUA: variableValue:
2016-05-16 20:39:38.980 LUA: -88
showing both NUTs as seen by my sitting room raspi and my hall raspi
and my script is "script_variable_bt2.lua"
Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
jvdz
Posts: 2189 Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:
Post
by jvdz » Monday 16 May 2016 21:49
I don't see the LUA error out there, so what is shown when that is happening?
Jos
blackdog65
Posts: 311 Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Norfolk, UK
Contact:
Post
by blackdog65 » Monday 16 May 2016 22:04
Sorry Jos,
It triggers a fault when the variable switches to "AWAY"
Code: Select all
2016-05-16 21:01:05.868 Error: EventSystem: in script_variable_bt2.lua: [string "--script_variable_bt2.lua..."]:6: attempt to compare nil with number
Would this be when the script attempts "tonumber" when the variable string is "AWAY"?
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
blackdog65
Posts: 311 Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Norfolk, UK
Contact:
Post
by blackdog65 » Monday 16 May 2016 22:06
Raspberry Piet wrote:
I put the RSSI value in a virtual custom sensor (idx2606) for graph.
Very pretty! How do you do this?
Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
Westcott
Posts: 423 Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:
Post
by Westcott » Monday 16 May 2016 22:12
Perhaps when the beacon is away, the reported value is NIL?
blackdog65 wrote: Sorry Jos,
It triggers a fault when the variable switches to "AWAY"
Code: Select all
2016-05-16 21:01:05.868 Error: EventSystem: in script_variable_bt2.lua: [string "--script_variable_bt2.lua..."]:6: attempt to compare nil with number
Would this be when the script attempts "tonumber" when the variable string is "AWAY"?
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
Raspberry Piet
Posts: 158 Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:
Post
by Raspberry Piet » Monday 16 May 2016 22:17
blackdog65 wrote: Raspberry Piet wrote:
I put the RSSI value in a virtual custom sensor (idx2606) for graph.
Very pretty! How do you do this?
Sean
Setup => Hardware => Dummy=> Create Virtual Sensors
(Domoticz Beta version needed i think)
Last edited by
Raspberry Piet on Monday 16 May 2016 22:19, edited 1 time in total.
jvdz
Posts: 2189 Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:
Post
by jvdz » Monday 16 May 2016 22:17
Maybe something like this works:
Code: Select all
commandArray = {}
for variableName, variableValue in pairs(uservariablechanged) do
numVal = tonumber(variableValue)
--
if numVal == nil then numVal = 0 end
if (variableName == 'Zhenya_SitRm') then
if variableValue == "AWAY" then
commandArray['ZSitRoomBT'] = "Off"
elseif numVal <= -51 and numVal >= -71 then
commandArray['ZSitRoomBT'] = "On"
end
end
end
return commandArray
Jos
blackdog65
Posts: 311 Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Norfolk, UK
Contact:
Post
by blackdog65 » Monday 16 May 2016 22:27
@Jos, Yes! I just need to fiddle with my numbers now for accurate switching... MANY MANY THANKS!
@Raspberry Piet Spasiba bolshoi moi drook
Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
Raspberry Piet
Posts: 158 Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:
Post
by Raspberry Piet » Monday 16 May 2016 22:36
blackdog65 wrote:
@Raspberry Piet Spasiba bolshoi moi drook
Sean
I'm glad there is google translate. I lied, i dont speak russian.
jvdz
Posts: 2189 Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:
Post
by jvdz » Monday 16 May 2016 22:39
Our language probably sounds as foreign to Sean as Russian anyways
Raspberry Piet
Posts: 158 Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:
Post
by Raspberry Piet » Monday 16 May 2016 22:42
jmleglise wrote: Raspberry Piet wrote: It is possible with the Nut app to make the Nut Beacon beep (find keys when lost), is it somehow possible to do the same through a script?
What this has to do with Domoticz ? What is the use case ?
When i lost my keys AND phone at the same time
No, you're right. It was just something that came up to my mind.
blackdog65
Posts: 311 Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Norfolk, UK
Contact:
Post
by blackdog65 » Tuesday 17 May 2016 8:59
jvdz wrote: Our language probably sounds as foreign to Sean as Russian anyways
This is why when English people hear something garbled and unintelligible, we describe it as sounding like "Double Dutch".
Bizarrely, the Dutch language is The English Language's closest relative... go figure
Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
woody4165
Posts: 476 Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:
Post
by woody4165 » Tuesday 17 May 2016 18:12
I'm still getting issues on reboot
The status is
active(exited) after reboot
the log says:
Code: Select all
2016-05-17 17:58:23,835 - root - CRITICAL - Error : hci0 interface not Running. Do you have a BLE device connected to hci0 ? Check with hciconfig !
pi@raspberrypi:~$ hciconfig
hci0: Type: BR/EDR Bus: UART
BD Address: xx:xx:xx:xx:xx:xx ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING
RX bytes:717 acl:0 sco:0 events:42 errors:0
TX bytes:1532 acl:0 sco:0 commands:42 errors:0
in /etc/init.d/check_beacon_presence
DAEMON_USER=root
I have 3 Nut and all visible with a BLE scanner
Any idea what I should do or check?
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
Raspberry Piet
Posts: 158 Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:
Post
by Raspberry Piet » Tuesday 17 May 2016 20:05
Hmmm. This is odd. I left my Nut Tag at the same place this whole night and day.
Looking at the RSSI graph of this Tag it shows a clear difference when someone is at home or all left (for work)
When no one is at home the signal is quite stable according to the graph.
When i want to use it for indoor positioning system it would be better when the signal is stable as well when someone is at home.
Maybe it is some device that interferes the bluetooth signal... Have to investigate further.
Is there already somebody with this same experience?
blackdog65
Posts: 311 Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Norfolk, UK
Contact:
Post
by blackdog65 » Wednesday 18 May 2016 0:35
I found placing a bottle of "Dr. Pepper" next to my tag caused a 25 point move. Took me a while to figure it out.
Stranger still, cups of tea or coffee had not affected it before
....... Maybe I'll stick with tea
Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
Users browsing this forum: No registered users and 1 guest