💬 MySensors Library - v2.x


  • Admin

    This thread contains comments for the article "MySensors Library - v2.x" posted on MySensors.org.


  • Mod

    As noticied by @AWI in https://forum.mysensors.org/topic/4612/where-does-mysensor-store-in-eeprom/ there are not 256 bytes to play with on an AtMega328.

    Also, it seems like the amount gets smaller for every version of MySensors. And the position is changed. So using saveState(20) on one MySensors version and loadState(20) on another version will result in the "wrong" byte being read back.

    Can we handle this in a nice way? Preferably without limiting the use to 512 bytes, since some mcus have more. Should macros be provided to check the maximum size? Should we add a pragma compile warning if saveState is used with a too large address?


  • Admin

    I've had some thought of letting the user-part of the eeprom grow from the end of the EEPROM. This would allow user storage to be unaffected when we add more internal stuff.

    Not sure how this would be done with different sizes of eeprom in mind.


  • Mod

    @hek That would at least keep the addresses same between versions, as long as the address is within the "free" space of the eeprom. (except that it would break compatibility one "final" time :))

    save/readState should then check the address at runtime and make sure it doesn't overwrite MySensors' own data. Adding a compile-time warning is possible as well, but won't detect if the sketch developer uses a non-static variable for the address.


  • Admin

    @mfalkvidd said:

    would break compatibility one "final" time

    Yep.

    Allowing more that the 256 bytes we do today would absolutely complicate things.


  • Admin



  • @hek: Could you change the part with "Here is a quick summary of the config options available. NOTE: This table will be updated with more information shortly" to be collapsed at the beginning and a + to exapand? Currently this section takes a lot of space and as it is essential for beginners might frighten new users 😉


  • Admin

    We talked about splitting up this page in more use-case based pages.



  • Nice to hear, keep the good work up!



  • In the "Create Repeating Nodes" section, could you please change:

    #define MY_REPEATER_NODE

    to

    #define MY_REPEATER_FEATURE

    I wasted a lot of time trying to figure out why my repeater node wasn't working.

    Thanks for a great product!


  • Admin

    @ileneken3

    Thanks for reporting, updated.


  • Mod



  • what is difference between MY_PARENT_NODE_ID and MY_PARENT_NODE_IS_STATIC ?
    when i add "MY PARENT NODE ID" to sketch of end node , so end node dont connect to controller directly ? and dont connect to other repeaters node? even when parent node is fail ?

    edit : i test this features but dont work ! i want the my end node connect to controller with for example parent with node id 3 ! node 3 is a repeater.... but every time (with move and reset) end node choose a new parent...


  • Contest Winner

    Hi, I could not find a setCommand() message Api to chose between SET or REQ, is this done on purpose? I think it may be legitimate for a node to send a REQ command instead of the default SET.
    Looks like mSetCommand(msg, C_SET) works but I'd avoid using not standard API calls.
    Thanks!


  • Plugin Developer

    @user2684

    void request(uint8_t childSensorId, uint8_t variableType, uint8_t destination);
    

    See "Requesting data" here:
    https://www.mysensors.org/download/sensor_api_20


  • Contest Winner

    @martinhjelmare Thanks, I've completely missed it expecting it somehow in the message constructor section, my bad! Thanks again



  • Hi I just finished configuring a site map having the sample node (S_DOOR) code above as the only thing and I noticed that it only updates once (only at every restart) to the Paper UI Control, The Basic UI, and to the Classic UI, I've already inserted a prinf to check if it would print to the serial monitor, and to also see if the value is changing on every loop and it is changing.

    But when I looked at the Karaf Console, the send() doestn't seem to be reflecting there:
    18:25:41.084 [WARN ] [ors.internal.gateway.MySensorsGateway] - Presented child is alredy present in gateway
    18:25:41.230 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13907396 TSF:MSG:READ,1-1-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
    18:25:41.385 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 1;255;3;0;6;0
    18:25:41.497 [DEBUG] [ors.internal.gateway.MySensorsGateway] - I_CONFIG request received from M, answering: (is imperial?)false
    18:25:41.636 [DEBUG] [orsAbstractConnection$MySensorsWriter] - Sending to MySensors: 1;255;3;0;6;M
    18:25:41.812 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13909293 !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=6,pt=0,l=1,sg=0,ft=0,st=NACK:M
    18:25:41.985 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13909301 TSF:MSG:READ,1-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    18:25:42.141 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13909309 TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
    18:25:42.313 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13909316 TSF:MSG:READ,1-1-0,s=1,c=1,t=16,pt=1,l=1,sg=0:0
    18:25:42.480 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 1;1;1;0;16;0
    18:25:42.597 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Node 1 found in gateway
    18:25:42.734 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Child 1 found in node 1
    18:25:42.846 [DEBUG] [sensors.handler.MySensorsThingHandler] - Updating channel: tripped(V_TRIPPED) value to: CLOSED
    18:25:43.009 [DEBUG] [sensors.handler.MySensorsThingHandler] - Setting last update for node/child 1/1 to 2018-05-31T18:25:42.000+0800
    18:25:43.034 [INFO ] [smarthome.event.ItemStateChangedEvent] - SampleDoorSensor01_LastUpdate changed from 2018-05-31T18:25:22.000+0800 to 2018-05-31T18:25:42.000+0800
    18:25:43.320 [INFO ] [smarthome.event.ItemStateChangedEvent] - mysensors_door_9bb51413_door_1_1_lastupdate changed from 2018-05-31T18:25:22.000+0800 to 2018-05-31T18:25:42.000+0800
    18:27:12.393 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999913 TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    18:27:12.518 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999921 TSF:MSG:BC
    18:27:12.600 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999923 TSF:MSG:FPAR REQ,ID=1
    18:27:12.745 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999927 TSF:PNG:SEND,TO=0
    18:27:12.886 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999931 TSF:CKU:OK
    18:27:13.029 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999934 TSF:MSG:GWL OK
    18:27:13.236 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14000772 TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    18:27:14.417 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14001947 TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    18:27:14.584 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14001954 TSF:MSG:PINGED,ID=1,HP=1
    18:27:14.728 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14001993 !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1
    18:28:40.531 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088079 TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    18:28:40.705 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088085 TSF:MSG:BC
    18:28:40.831 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088088 TSF:MSG:FPAR REQ,ID=1
    18:28:40.966 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088092 TSF:PNG:SEND,TO=0
    18:28:41.096 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088095 TSF:CKU:OK
    18:28:41.220 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088098 TSF:MSG:GWL OK
    18:28:41.489 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14089036 TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    18:28:42.576 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14090113 TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    18:28:42.745 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14090119 TSF:MSG:PINGED,ID=1,HP=1
    18:28:42.899 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14090159 !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1
    18:30:08.695 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176243 TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    18:30:08.796 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176250 TSF:MSG:BC
    18:30:08.911 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176253 TSF:MSG:FPAR REQ,ID=1
    18:30:09.050 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176257 TSF:PNG:SEND,TO=0
    18:30:09.183 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176261 TSF:CKU:OK
    18:30:09.315 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176264 TSF:MSG:GWL OK
    18:30:09.464 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176282 TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    18:30:10.698 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14178277 TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    18:30:10.865 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14178284 TSF:MSG:PINGED,ID=1,HP=1
    18:30:11.007 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14178324 !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1



  • Please disregard my prev inquiry, I was able to find a solution that same day, but it required me to modify MySensors library (inside RF24_spiMultiByteTransfer function) and also exposed one of the functions in RF24.h to get it to work.


 

Suggested Topics

240
Online

7.8k
Users

8.7k
Topics

92.9k
Posts