Arduino Sensor 1.3 Beta 2

You don’t need to change your sketches. Just recompile them with the updated MySensors-library like you did.

The correct data-rate is set by the library also when it is initialized… no need to change anything in gateway code (except perhaps PA-level).

Hi. I Moved from version 1.2 + to 1.3 b2. Firmware and library devices updated, they work fine. How to update files on the gateway Vera Lite? There’s no button to delete. I downloaded the new files. But the plugin writes version 1.2 + and at the same time it works O_o
And I have one relay. It works fine, but the picture does not change lightbulbs in the interface Vera when enabling or disabling.

To update the Gateway Luup files in Vera, you’ll load the same way you loaded the original Gateway files. In UI5, go to Apps/ Develop Apps upload the new files. You’ll obviously need to also update your firmware in your Nano (if that’s what you’re using for the gateway)

Hek is waiting for feedback before changing the version so you’ll still see 1.2+ in the version.
You should not need to delete your gateway in Vera. Just word of warning, if you do, all your sensors will also be deleted.

Currently I’m not using a Relay so I can’t test but so far all my Temperature and Pressure sensors have been reporting well since the upgrade.

Yes, as soon as I mostly get positive feedback (on stability) from the users I will “close” the 1.3 branch and begin the 1.4 development.

Good to hear!

To update the Gateway Luup files in Vera, you’ll load the same way you loaded the original Gateway files. In UI5, go to Apps/ Develop Apps upload the new files. You’ll obviously need to also update your firmware in your Nano (if that’s what you’re using for the gateway)

Hek is waiting for feedback before changing the version so you’ll still see 1.2+ in the version.
You should not need to delete your gateway in Vera. Just word of warning, if you do, all your sensors will also be deleted.

Currently I’m not using a Relay so I can’t test but so far all my Temperature and Pressure sensors have been reporting well since the upgrade.[/quote]

Thanks!
Tell us how to modify the code Motionsensor to get value from the two interrupts at once?

I have a couple of DHT22 Temperature and Humidity sensors running and in the Gateway log file, I see the following errors when the Sensor node “starts”:

50   02/08/14 15:15:58.974   luup_log:76: Arduino: Log: Relaying message back to gateway. <0x2e633680>
50   02/08/14 15:15:58.985   luup_log:76: Arduino: Log: Sending: from=0, to=2, childId=255, mtype=4, type=13, crc=177, 'I <0x2e633680>
01   02/08/14 15:15:58.986   luup_log:76: Arduino: Receive error: Unknown data: ', sent via 0 <0x2e633680>

If I capture the Arduino Node console output and paste it into an editor, you can see there is a carriage return before the closing ’

Sent successfully
Received: from=0, to=2, childId=255, mtype=4, type=13, crc=177, 'I
'
Mess crc ok.
Message addressed for this node.
Relaying message back to gateway.

Here is an example from an S_DIMMER node that I am developing (I will share it here when it is done). The issue occurs whenever I change the dim level using UI5 - the gateway sends the message to the Sensor and when it is relayed back to the gateway, you see the error.

Gateway log

50	02/08/14 15:38:00.062	luup_log:76: Arduino: Sending: 1;0;1;3;10 <0x2f433680>
50	02/08/14 15:38:00.075	luup_log:76: Arduino: Log: Relaying message back to gateway. <0x2e633680>
50	02/08/14 15:38:00.085	luup_log:76: Arduino: Log: Sending: from=0, to=1, childId=0, mtype=1, type=3, crc=174, '10 <0x2e633680>
01	02/08/14 15:38:00.086	luup_log:76: Arduino: Receive error: Unknown data: ', sent via 0 <0x2e633680>
50	02/08/14 15:38:00.087	luup_log:76: Arduino: Log: Sent successfully <0x2e633680>
50	02/08/14 15:38:00.105	luup_log:76: Arduino: Log: Received: from=1, to=0, childId=0, mtype=1, type=3, crc=183, '10 <0x2e633680>
01	02/08/14 15:38:00.106	luup_log:76: Arduino: Receive error: Unknown data: ' <0x2e633680>
50	02/08/14 15:38:00.107	luup_log:76: Arduino: Log: Message crc ok. <0x2e633680>
50	02/08/14 15:38:00.114	luup_log:76: Arduino: Log: Message addressed for this node. <0x2e633680>
50	02/08/14 15:38:00.115	luup_log:76: Arduino: Set Var: 1;0;1;3;10 <0x2e633680>
50	02/08/14 15:38:00.116	luup_log:76: Arduino: Setting variable 'LoadLevelStatus' to value '10' <0x2e633680>
50	02/08/14 15:38:00.116	luup_log:76: Arduino: urn:upnp-org:serviceId:Dimming1,LoadLevelStatus, 10, 88 <0x2e633680>
50	02/08/14 15:38:00.117	luup_log:76: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdate, 1391902680, 88 <0x2e633680>

Sensor log

Received: from=0, to=1, childId=0, mtype=1, type=3, crc=174, '10
'
Mess crc ok.
Message addressed for this node.
Relaying message back to gateway.
Sending: from=1, to=0, childId=0, mtype=1, type=3, crc=183, '10
', sent via 0
Sent successfully
Incoming change for dimmer on pin:0, New status: 10

It seems it only happens when Relaying messages back to the gateway (seems like a newline is appended to the relay message before it is sent back to the gateway). I poked around in the Gateway and Sensor code to see if I could fix it but the root cause isn’t obvious to me. It doesn’t seem to affect the overall functionality but it is a bug of some sort…

@blacey
Please update to the latest 1.3beta2 from github.

My 8-channel relay module and gateway are working fine on beta 2.

Hek, thanks. I actually thought I upgraded to 1.3B2 but realized that the logging changed from Send/Receive to Tx/Rx accordingly so apparently I didn’t put the libraries in the right location for the Arduino IDE… I moved them into place, reflashed the gateway and the sensor node and it looks better, at least for my S_DIMMER node.

50	02/08/14 16:29:27.950	luup_log:76: Arduino: Sending: 1;0;1;3;10 <0x2fec3680>
50	02/08/14 16:29:27.965	luup_log:76: Arduino: Log: Found child in routing table. Sending to 1 <0x2e633680>
50	02/08/14 16:29:27.974	luup_log:76: Arduino: Log: Tx: fr=0,to=1,la=0,ne=1,ci=0,mt=1,ty=3,cr=174: 10 <0x2e633680>
50	02/08/14 16:29:27.976	luup_log:76: Arduino: Log: Sent successfully <0x2e633680>
50	02/08/14 16:29:27.984	luup_log:76: Arduino: Log: Message available on pipe 1 <0x2e633680>
50	02/08/14 16:29:27.986	luup_log:76: Arduino: Log: Rx: fr=1,to=0,la=1,ci=0,mt=1,t=3,cr=183(ok): 10 <0x2e633680>
50	02/08/14 16:29:27.994	luup_log:76: Arduino: Log: Message addressed for this node. <0x2e633680>
50	02/08/14 16:29:27.995	luup_log:76: Arduino: Set Var: 1;0;1;3;10 <0x2e633680>
50	02/08/14 16:29:27.996	luup_log:76: Arduino: Setting variable 'LoadLevelStatus' to value '10' <0x2e633680>
50	02/08/14 16:29:27.996	luup_log:76: Arduino: urn:upnp-org:serviceId:Dimming1,LoadLevelStatus, 10, 88 <0x2e633680>
50	02/08/14 16:29:27.997	luup_log:76: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdate, 1391905767, 88 <0x2e633680>
Message available on pipe 1
Rx: fr=0,to=1,la=0,ci=0,mt=1,t=3,cr=174(ok): 10
Message addressed for this node.
Relaying message back to gateway.
Tx: fr=1,to=0,la=1,ne=0,ci=0,mt=1,ty=3,cr=183: 10
Sent successfully
Incoming change for dimmer on pin:0, New status: 10

I still see a few send failures to the gateway so I bumped the power up to RF24_PA_HIGH to see if that helps.

I found an edge-case bug. I have a Sensor node dimmer the works fine from the UI and using luup call actions to set the dimmer loadLevelTarget however it fails if I attempt to set the loadLevelTarget from a URL due to a nil value exception in L_Arduino.lua.

Curl request and ok response

 curl 'http://vera:3480/data_request?id=action&DeviceNum=88&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadLevelTarget=3'

<?xml version="1.0"?>
<u:SetLoadLevelTargetResponse xmlns:u="urn:schemas-upnp-org:service:Dimming:1">
<OK>OK</OK>
</u:SetLoadLevelTargetResponse>

Gateway Log - exception while attempting to concenate nil ‘value’ variable to string.

50	02/09/14 7:10:40.174	luup_log:76: Arduino: Request status for LoadLevelStatus <0x2e8c5680>
50	02/09/14 7:10:40.174	luup_log:76: Arduino: Sending: 1;0;3;3;1 <0x2e8c5680>
50	02/09/14 7:10:40.190	luup_log:76: Arduino: Log: Found child in routing table. Sending to 1 <0x2e8c5680>
50	02/09/14 7:10:40.192	luup_log:76: Arduino: Log: Tx: fr=0,to=1,la=0,ne=1,ci=0,mt=3,ty=3,cr=0: 1 <0x2e8c5680>
50	02/09/14 7:10:40.220	luup_log:76: Arduino: Log: Sent successfully <0x2e8c5680>

01	02/09/14 7:12:24.595	LuaInterface::CallFunction_Job device 88 function SDimming1_Dimming1_SetLoadLevelTarget_run failed [string "module("L_Arduino", package.seeall)..."]:390: attempt to concatenate local 'value' (a nil value) <0x2ff55680>
50	02/09/14 7:28:55.270	luup_log:76: Arduino: Log: Message available on pipe 2 <0x2e8c5680>

Line 390 in L_Arduino.lua

389:  function sendCommandWithMessageType(altid, messageType, variableId, value)
390:          local cmd = altid..";".. msgType[messageType] .. ";" .. variableId .. ";" .. value
391:          log("Sending: " .. cmd)
392:  
393:          if (luup.io.write(cmd) == false)  then
394:                  task("Cannot send command - communications error", TASK_ERROR)
395:                  luup.set_failure(true)
396:                  return false
397:          end
398:          return true
399:   end

HEK,

Something doesn’t seem to be working right for me. I have downloaded the libraries and put them in the right place (I think). I deleted the old Vera library at the suggestion of gregl. I re-uploaded the json and xml files to Vera, flashed the new sketch to my nano gateway then flashed a couple of sensors. It seems like the gateway will communicate with the sensors once then stop. Here is my log:

50 02/09/14 16:15:37.011 luup_log:27: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,RelayNode, 0, 30 <0x2e7e7680> 50 02/09/14 16:15:37.011 luup_log:27: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,RelayNodeHR, GW, 30 <0x2e7e7680> 50 02/09/14 16:15:37.012 luup_log:27: Arduino: Presentation: 1;0;0;16;1.2+ <0x2e7e7680> 50 02/09/14 16:15:37.013 luup_log:27: Arduino: Set Var: 1;0;1;23;2 <0x2e7e7680> 50 02/09/14 16:15:37.014 luup_log:27: Arduino: Setting variable 'CurrentLevel' to value '2' <0x2e7e7680> 50 02/09/14 16:15:37.014 luup_log:27: Arduino: urn:micasaverde-com:serviceId:LightSensor1,CurrentLevel, 2, 31 <0x2e7e7680> 50 02/09/14 16:15:37.014 luup_log:27: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdate, 1391987737, 31 <0x2e7e7680> 06 02/09/14 16:15:37.015 Device_Variable::m_szValue_set device: 31 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdate was: 1391987688 now: 1391987737 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2e7e7680>

Any idea what I did wrong?

Thanks,

Pete

[quote=“petewill, post:31, topic:179310”]HEK,

Something doesn’t seem to be working right for me. I have downloaded the libraries and put them in the right place (I think). I deleted the old Vera library at the suggestion of gregl. I re-uploaded the json and xml files to Vera, flashed the new sketch to my nano gateway then flashed a couple of sensors. It seems like the gateway will communicate with the sensors once then stop. Here is my log:

Any idea what I did wrong?[/quote]

Nope, no idea :wink:

Are you still having sensors with the old version transmitting?

I’ve loaded 1.3b2 into my testbed VeraLite (1.5.622) with the SerialGateway and a single sensor (DHT22) to test with. What I’ve found is that the sensor is only successfully getting through to the gateway on the first transmission (T then H). After that, it is only updating the second variable sent (H). If I change the order of the measurement in the sketch, humidity first then temperature, I get H and T on startup, but only T after that. I even threw in a delay(200) in between the two just for kicks and still no difference.

Reverted back to the prior version and all works as expected. Updated both gateway and sensor one more time and I can reproduce the condition. I’m switching between the two on a Mac OS X IDE 1.05 by changing the “Arduino” directory name that contains the new and old codes. All Vera files (D_, I_, L_, S_, etc.) are the new ones.

If you need anymore information, let me know, I’m reverting back for now.

Sal

What, you can’t tell from that tiny bit of info I gave you? :wink: Just kidding. I am really doing my best to learn and read before asking but I’m slow to learn all this. I am so excited for the potential I have been doing some Arduino tutorials to try to learn the basics. It’s slow going though.

Ok, maybe this will help a little more. I plugged my Nano gateway (with the new 1.3b sketch uploaded to it) into my computer and watched the serial monitor (no other sensors were powered up at this time). I had one light sensor already powered up (also had the new sketch) and I got this:

0;0;4;11;Arduino startup complete.

It never got beyond the startup complete so I removed power from my light sensor then plugged it back in (5v USB adapter) and I got this:

0;0;4;11;Arduino startup complete. //Power cycled light sensor 1;255;4;7;0 1;0;0;16;1.2+ 1;0;1;23;10

It still never updated so I power cycled again and then got this:

0;0;4;11;Arduino startup complete. //Power cycled light sensor first time 1;255;4;7;0 1;0;0;16;1.2+ 1;0;1;23;10 //Power cycled light sensor second time 1;255;4;7;0 1;0;0;16;1.2+ 1;0;1;23;75

I reuploaded the sketch to the light sensor and got the same results (only one light level transmission to the Nano gateway). Could I be uploading the sketches wrong? Am I supposed to be uploading the ClearEepromConfig first? Can the light sensor remain plugged into the Pro Mini while uploading? I am very new to all this so it could be something very simple.

Thanks,

Pete

I had some people reporting the same issues (only second send after powerup would send value). I updated all the “sleeping” example sketches a day ago adding a gw.powerUp() at the beginning of the loop().

Could you test this version (latest in github master branch)?

Hi Hek

I had the problem above
adding the
gw.powerUp(); // Power up radio

line to the motion sensor script fixed this one for me!

Sorry i had not had time to report it earlier…

many thanks

HEK,

Once again, thank you! That worked! I have tested both a light sensor and a motion sensor and they are now updating. Also, I didn’t realize this but the sketches are in the libraries folder. That may have been part of my problem. I may have been using old code. For anyone else like me who is totally new to this the path is https://github.com/mysensors/Arduino then click libraries > MySensors > examples.

On a completely separate note, has anyone had any issues with the motion sensor cycling from tripped/not tripped no matter what the sensitivity is set to? I have two motion sensors and they are both doing it to varying degrees. One of mine, once tripped, will cycle for over a minute from tripped/not tripped. This was happening with the 1.2 as well.

first of all i will recommend you to check how you hardware sensor is working regardless radio/gateway/vera
attach multimeter to the output of the sensor to monitor sensor output independantly from the arduino

axill,

Thanks. I am planning on doing that. Still beyond my skill set but hopefully not for long. Doing tutorials/watching videos on Arduino everyday on my way to/from work. I just didn’t know if anyone else had had the problem and fixed it with some sort of resistor or capacitor magic.

I’ll post back if/when I can get it figured out.

Thanks.

petewill,

I played with motion sensor like this one http://www.buyincoins.com/item/7078.html and experienced no problem.

Regards,
Alexander