Update devices rfy devices status

Moderator: leecollings

Post Reply
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Update devices rfy devices status

Post by deennoo »

Hi There.

I have a Somfy rts sunblind, all is ok with m'y rfxcom.

On Domoticz he got 3 buttons :
- open
- close
- stop

Using m'y RFLink i'm able to know if the Real remote is used and which ordre is send.

I want to use this ability to update the rfx devices. Not trigger but really update using commandarray['updatedevice'] command.

I found that value can be 0 or 1 but this value never update the device to "open".

Is There another secret value or do I need to use the Json api?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
zicht
Posts: 272
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Update devices rfy devices status

Post by zicht »

Hi

Have a look here, had simmilar questions before :
http://www.domoticz.com/forum/viewtopic ... 65#p137111

The only thing that does not work is receiving the original remote... so worked around that.
Hope it helps to understand better :)
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Update devices rfy devices status

Post by deennoo »

zicht wrote:Hi

Have a look here, had simmilar questions before :
http://www.domoticz.com/forum/viewtopic ... 65#p137111

The only thing that does not work is receiving the original remote... so worked around that.
Hope it helps to understand better :)
Rfx will never listen about Real remote, éven a Somfy tahoma didn't listen about rts remote.

Only RFLink or rfp1000 Can do this

Will check your code
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
lec668
Posts: 13
Joined: Sunday 29 January 2017 13:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Paris / France !
Contact:

Re: Update devices rfy devices status

Post by lec668 »

@Deeno

Hi,

Were you able to figure how to change the Somfy blinds status ? Here I'm trying to change it depending on a sensor.

I'm having the same trouble, RFY status change to 'stopped' whatever I put in the commandArray['UpdateDevice'] command, (tried On/Off Open/Closed...

if (devicechanged ['sensor_baie_bureau'] == "Open") then
print ("STORE BUREAU Open")
commandArray['UpdateDevice']='280|0|Off'
end

The command workds fine with another on/off light switch, but I've never beeen able to use it with a blind.

Regards !
meal
Posts: 107
Joined: Monday 04 March 2019 14:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: France
Contact:

Re: Update devices rfy devices status

Post by meal »

Hello

I add the same functionality to setup.

You can use the following LUA function to update the RTS Blind based on the Status of the remote control.

function Visu_Blind_Status(Blind, Status)
json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()
iBlind=otherdevices_idx[Blind]
if Status=='On' then
value=18 -- Closed for Venetian EU Blind
elseif Status=='Off' then
value=17 -- Open for Venetian EU Blind
else
value=0 -- Stop
end
local url0 ="https://<<IP address>>/json.htm?type=command&param=udevice&idx=" .. iBlind.. "&nvalue=" ..value.. "&svalue=0&parsetrigger=false"
local url ='curl -s "' .. url0 .. '"'
local handle = io.popen(url)
local result = handle:read("*a")
handle:close()
output = json:decode(result)
if output==nil then
return nil
end
if output.status~="OK" then
return nil
end
return true
end

Example of implementation:

Blind1, Blind2, Blind3 are the name of the Somfy Blinds
Remote Control1, Remote Control2,Remote Contro3 are the name of the remote controls
Status is Open , Stopped or Closed


local RemoteControlBlinds = {
["Remote Control1"]="Blind1",
["Remote Control2"]="Blind2",
["Remote Control3"]="Blind3",
}


function timedifference(timestamp)
y, m, d, H, M, S = timestamp:match("(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+)")
difference = os.difftime(os.time(), os.time{year=y, month=m, day=d, hour=H, min=M, sec=S})
return difference
end

for RemoteControlBlind,Blind in pairs(RemoteControlBlinds) do
if (devicechanged[RemoteControlBlind]) then
s = otherdevices_lastupdate[RemoteControlBlind]
Status=otherdevices[RemoteControlBlind]
if timedifference(s) > 1 then -- to avoid successive state changes sent by the remote control
Visu_Blind_Status(Blind, Status)
end
end
end

BR
meal
lec668
Posts: 13
Joined: Sunday 29 January 2017 13:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Paris / France !
Contact:

Re: Update devices rfy devices status

Post by lec668 »

Thanks, will have à look and convert it to "pure" lua / not JSON

Où avais-tu trouvé les valeurs 17 et 18 ?

Encore merci ! Thx
meal
Posts: 107
Joined: Monday 04 March 2019 14:59
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: France
Contact:

Re: Update devices rfy devices status

Post by meal »

Hello,

I found the values 17 and 18 In the source codes.

I would be interested in the LUA version when you get it.

BR
meal
lec668
Posts: 13
Joined: Sunday 29 January 2017 13:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Paris / France !
Contact:

Re: Update devices rfy devices status

Post by lec668 »

OK, I understand now, the "official" n & s values I took from the json documentation are not the ones I get

When manually testing with a http request I get
0 -> stopped
1 -> open
3 -> closed

So to reflect the real state of the blind, taken from my 'sensor_baie_bureau' here, it would change my script like this :


commandArray = {}

-- loop through all the changed devices
-- for deviceName,deviceValue in pairs(devicechanged) do
-- print ("Device based event fired on '"..deviceName.."', value '"..tostring(deviceValue).."'");
-- end

if (devicechanged ['sensor_baie_bureau'] == "Closed") then
print("STORE BUREAU en cours de fermeture")
print( otherdevices['STORE BUREAU'] )
commandArray['UpdateDevice'] = '280|3|0'
--commandArray[#commandArray+1] = {['UpdateDevice'] = '280|3|0' }
elseif (devicechanged ['sensor_baie_bureau'] == "Open") then
print( otherdevices['STORE BUREAU'] )
print("STORE BUREAU completement ouvert")
commandArray['UpdateDevice'] = '280|1|0'
--commandArray[#commandArray+1] = {['UpdateDevice'] = '280|1|0' }
elseif (devicechanged ['BOUTON2'] == "Click") then
print("Click BOUTON2")
print( otherdevices['STORE BUREAU'] )
print("Click BOUTON2")
--just show the state of the blind in log when I press a pushbutton
end

return commandArray


Thanks for pointing me in the right direction ! A charge de revanche
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests