[Solved] Cannot enable/disable Somfy sun detector anymore

Hello,
I don’t know since when but the LUA code than I used to run to enable or disable the sun detector of my somfy screen is now doing nothing.

Sample code : luup.call_action(“urn:upnp-rfxcom-com:serviceId:rfxtrx1”, “SendCommand”, {DeviceId=31, CommandType=“ENABLE_DETECTOR”}, 11)

In the log I got the following error :

01 07/26/19 16:14:17.112 LuaInterface::CallFunction_Job device 11 function SRFXtrx_rfxtrx1_SendCommand_run failed [string “module(“L_RFXtrx”, package.seeall)…”]:1546: bad argument #2 to ‘format’ (integer expected, got nil) <0x6dcc5520>

I was using instruction from here : http://forum.micasaverde.com/index.php/topic,31363.msg236870.html#msg236870

Any help is appreciated.
Michel

It would help to see some log debug entries prior to the logged error. A couple of those should start with “sendUnusualCommand”
Also, try replacing ENABLE_DETECTOR with Enable.

Thank you,

Here are more log lines :

08 07/27/19 8:22:16.387 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunScene <0x6e8c5520>
08 07/27/19 8:22:16.387 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1 <0x6e8c5520>
08 07/27/19 8:22:16.387 JobHandler_LuaUPnP::HandleActionRequest argument action=RunScene <0x6e8c5520>
08 07/27/19 8:22:16.388 JobHandler_LuaUPnP::HandleActionRequest argument SceneNum=11 <0x6e8c5520>
08 07/27/19 8:22:16.388 JobHandler_LuaUPnP::HandleActionRequest argument rand=0.38029019685941634 <0x6e8c5520>
08 07/27/19 8:22:16.388 Scene::RunScene running 11 Capteur soleil ON <0x6e8c5520>
08 07/27/19 8:22:16.389 JobHandler_LuaUPnP::HandleActionRequest device: 11 service: urn:upnp-rfxcom-com:serviceId:rfxtrx1 action: SendCommand <0x6e8c5520>
08 07/27/19 8:22:16.389 JobHandler_LuaUPnP::HandleActionRequest argument CommandType=ENABLE_DETECTOR <0x6e8c5520>
08 07/27/19 8:22:16.389 JobHandler_LuaUPnP::HandleActionRequest argument DeviceId=31 <0x6e8c5520>
01 07/27/19 8:22:16.390 LuaInterface::CallFunction_Job device 11 function SRFXtrx_rfxtrx1_SendCommand_run failed [string “module(“L_RFXtrx”, package.seeall)…”]:1546: bad argument #2 to ‘format’ (integer expected, got nil) <0x6e8c5520>
08 07/27/19 8:22:21.101 JobHandler_LuaUPnP::HandleActionRequest device: 19 service: urn:upnp-org:serviceId:SwitchPower1 action: SetTarget <0x7690a520>
08 07/27/19 8:22:21.101 JobHandler_LuaUPnP::HandleActionRequest argument newTargetValue=0 <0x7690a520>
06 07/27/19 8:22:21.886 Device_Variable::m_szValue_set device: 11 service: urn:rfxcom-com:serviceId:rfxtrx1 variable: LastReceivedMsg was: 04 02 01 29 00 now: 04 02 01 2A 00 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x6ecc5520>
06 07/27/19 8:22:21.886 Device_Variable::m_szValue_set device: 11 service: upnp-rfxcom-com:serviceId:rfxtrx1 variable: VeraTime was: 1564208466 now: 1564208541 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x6ecc5520>

With your suggested modification (Enable instead of ENABLE_DETECTOR) it goes like this:
I’ve got an error and a message on the vera interface “Error in Lua code for scenes and events”

08 07/27/19 8:26:35.888 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: RunScene <0x6e110520>
08 07/27/19 8:26:35.889 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1 <0x6e110520>
08 07/27/19 8:26:35.889 JobHandler_LuaUPnP::HandleActionRequest argument action=RunScene <0x6e110520>
08 07/27/19 8:26:35.889 JobHandler_LuaUPnP::HandleActionRequest argument SceneNum=11 <0x6e110520>
08 07/27/19 8:26:35.889 JobHandler_LuaUPnP::HandleActionRequest argument rand=0.5161899945335009 <0x6e110520>
08 07/27/19 8:26:35.889 Scene::RunScene running 11 Capteur soleil ON <0x6e110520>
01 07/27/19 8:26:35.890 LuaInterface::CallFunction_Scene Scene 11 failed attempt to call a nil value <0x6e110520>
08 07/27/19 8:26:40.101 JobHandler_LuaUPnP::HandleActionRequest device: 19 service: urn:upnp-org:serviceId:SwitchPower1 action: SetTarget <0x767d6520>
08 07/27/19 8:26:40.101 JobHandler_LuaUPnP::HandleActionRequest argument newTargetValue=0 <0x767d6520>
06 07/27/19 8:26:40.879 Device_Variable::m_szValue_set device: 11 service: urn:rfxcom-com:serviceId:rfxtrx1 variable: LastReceivedMsg was: 04 02 01 02 00 now: 04 02 01 03 00 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x6e310520>
06 07/27/19 8:26:40.880 Device_Variable::m_szValue_set device: 11 service: upnp-rfxcom-com:serviceId:rfxtrx1 variable: VeraTime was: 1564208732 now: 1564208800 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x6e310520>
06 07/27/19 8:26:41.952 Device_Variable::m_szValue_set device: 80 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Watts was: 0 now: 0 #hooks: 0 upnp: 0 skip: 0 v:0xc9f468/NONE duplicate:1 <0x767d6520>
06 07/27/19 8:26:41.953 Device_Variable::m_szValue_set device: 80 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: ActualUsage was: 1 now: 1 #hooks: 0 upnp: 0 skip: 0 v:0xc9ead0/NONE duplicate:1 <0x767d6520>

I’ll probably make a code change to better handle this situation. To confirm my suspicion can you go to the Advanced tab for your Somfy device and under Variables tell me what appears in the RFYMode variable?
Your Somfy device is an awning - right?

Thank you

The RFYMode is “STANDARD”
My device is a sunscreen roller blind
Only the motor/remote/wind-sun sensor is from Somfy
See here : https://www.brustor.com/en/products/roller-blinds/b-1100-zip-roller-blinds

Change the RFYMode to AWNING and with ENABLE_DETECTOR changed to Enable in your code, tray again.

1 Like

It works! Is it possible to activate this with standard mode?
Best regards,
Michel

Why do you need standard mode? Are there commands that are not working for you? Standard mode has commands you probably don’t need - like commands for changing the angle of Venetian blinds.

Well it’s just that it used to work fine without changing mode. It’s complicated enough to have all of this working, now I have added to my todo list that I should change the mode of the device in order to have it working.

A bit off topic (and absolutely not your fault of course) but I believe it’s a shame when you consider all that’s possible with automation but you need a lot of knowledge to make it happen. My wife always says that if I die, she won’t be able to do anything with the house. I’ve setup a lot of stuff that are not designed to work together. I have a vera box, a BTicino box, a raspberry with some gateways (in java, php and nodejs), I use ifttt too. It works “ok” (a reboot is sometimes needed) but it’s a pain in the ass when something fails. This world is still missing something to put it all together nicely :wink:

PS: a big thank you for you help! :smile: