g1velo / SNAVXbee2

0 stars 0 forks source link

Items Configuration by using SNAVXbee2 #6

Closed amarpulli1994 closed 7 years ago

amarpulli1994 commented 7 years ago

@g1velo Hello, Can you please share the item configuration. My Item configuration like this Switch test_light { channel = "snavxbee2:sample:gateway:0013A20041268524:DIO11" } Is there any wrong configurations, because it's not work for me. In my case Discovering process and everything done, but not able to send commands to end device. Every time send b command to end device. Thanks, Amar.

g1velo commented 7 years ago

Hi, the last part of the channel should be following the jave enum format : http://ftp1.digi.com/support/documentation/html/90001439/com/digi/xbee/api/io/IOLine.html in your case it should be DIO11_PWM1 I new to re set up my personal IDE to work again on this. Give ma one more week and it should work.

amarpulli1994 commented 7 years ago

@g1velo Hi, Sorry for late response. I hope resolve my issue at SNAVXbee2 and also I have face the issue, how to define things in demo.things file , which are the things connected to bridge. I mean define the things format. See as mentioned below

Bridge snavxbee2:bridge:gateway[ serialPort="COM9", baudRate=115200 ] 
{
        /** define things connected to that bridge here */
}

I did the clone your project file. Then how to generate jar file. Is there any specific IDE for build jar file. I am waiting for your suggestion. Thanks, Amar.

g1velo commented 7 years ago

Hi Amar,
I have commited the last version. To generate the jar files you must select : export Deployable plug-ins and Fragments Next .. next next In my case I had to close some project as I was getting error during export. Select all project in the Runtime java workset => Close project.

amarpulli1994 commented 7 years ago

Hello @g1velo , Thanks for spend valuable time for me.I have done to build the jar file successfully and it is working fine (Discovering process). When I am sending packets to End device, it will throws some warnings see as mentioned below

18:51:04.913 [WARN ] [ome.core.thing.internal.ThingManager] - Cannot delegate co
mmand 'ON' for item 'XbeeDIO11switch' to handler for channel 'snavxbee2:sample:g
ateway:0013A20040E7782D', because no thing with the UID 'snavxbee2:sample:gatewa
y' could be found.
18:51:04.914 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'XbeeDIO11swi
tch' received command ON
18:51:04.915 [WARN ] [ome.core.thing.internal.ThingManager] - Cannot delegate up
date 'ON' for item 'XbeeDIO11switch' to handler for channel 'snavxbee2:sample:ga
teway:0013A20040E7782D', because no thing with the UID 'snavxbee2:sample:gateway
' could be found.
18:51:04.919 [INFO ] [marthome.event.ItemStateChangedEvent] - XbeeDIO11switch ch
anged from OFF to ON
18:51:08.328 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive
d from 0013A20040E7782D - {[DIO10/PWM0: Low]}
18:51:08.329 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - we have to update
snavxbee2:sample:gateway:0013A20040E7782D snavxbee2:sample  

My Item Configuration file:

Switch XbeeDIO11switch "XbeeDIO11switch " (All) { channel = "snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10" }

End Device XBee Port it has to be configured as IOMode.DIGITAL_OUT_HIGH or IOMode.DIGITAL_OUT_LOW I have to tried both but there is no result . see xbee port configured in below screen shot new_xbee What I can do for successfully sending packets to end device. Thanks, Amar.

g1velo commented 7 years ago

I changed the ESH-INF definition file to expected value. Hope this will work now.. let me know !

amarpulli1994 commented 7 years ago

Hi, @g1velo Yeah! sure I will test and let you know the results. Thanks, Amar.

amarpulli1994 commented 7 years ago

Hi, @g1velo I did refer and made modifications to ESH-INF definition file. It happens while sending packet to the End device getting the warnings . see as mentioned below

11:39:38.362 [WARN ] [ome.core.thing.internal.ThingManager] - Cannot delegate co
mmand 'ON' for item 'XbeeDIO11switch' to handler for channel 'snavxbee2:sample:g
ateway:0013A20040E7782D', because no thing with the UID 'snavxbee2:sample:gatewa
y' could be found.
11:39:38.454 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'XbeeDIO11swi
tch' received command ON
11:39:38.455 [WARN ] [ome.core.thing.internal.ThingManager] - Cannot delegate up
date 'ON' for item 'XbeeDIO11switch' to handler for channel 'snavxbee2:sample:ga
teway:0013A20040E7782D', because no thing with the UID 'snavxbee2:sample:gateway
' could be found.
11:39:38.457 [INFO ] [marthome.event.ItemStateChangedEvent] - XbeeDIO11switch ch
anged from OFF to ON

My Item Configuration like: Switch XbeeDIO11switch "XbeeDIO11switch " (All) { channel = "snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10" } My Thing Configuration in demo.thing file :

yahooweather:weather:berlin [ location=638242 ]
astro:sun:home   [ geolocation="52.5200066,13.4049540", interval=60 ]
astro:moon:home  [ geolocation="52.5200066,13.4049540", interval=60 ]
ntp:ntp:demo [ hostname="nl.pool.ntp.org", refreshInterval=60, refreshNtp=30 ]
Bridge snavxbee2:bridge:gateway[ serialPort="COM5",  baudRate=9600 ] 
{ 

        /** define things connected to that bridge here */
}
// vim: syntax=Xtend

here, what is the define things connected to that bridge? Is there any define things in demo.thing file. End Device XBee Port DIO10/PWMO it has to be configured as IOMode.DIGITAL_OUT_HIGH or IOMode.DIGITAL_OUT_LOW. I have tried to both modes but there is no result. Please let me know the working configurations.

Thanks, Amar.

amarpulli1994 commented 7 years ago

Hello, @g1velo This is how I define my thing file as mentioned below. Is that right ?

Bridge snavxbee2:bridge:gateway[ serialPort="COM5",  baudRate=9600 ] 
{ 
        snavxbee2:sample:gateway:0013A20040E7782D

        /** define things connected to that bridge here */
}

Here snavxbee2:sample:gateway:0013A20040E7782D is a End Device thing. Thanks, Amar.

g1velo commented 7 years ago

Hi @amarpulli544 Could you please try 2 things :

  1. Remove the snavxbee2:sample:gateway:0013A20040E7782D end device from the thing file. use the discovery process to add it again. Or 2 update the snavxbee2:sample:gateway:0013A20040E7782D to : Thing sample 0013A20040E7782D [ Xbee64BitsAddress="0013A20040E7782D" , IOChannel="123" ] PS : IOChannel is unused.. So you file should look like :
Bridge snavxbee2:bridge:gateway[ serialPort="COM5",  baudRate=9600 ] 
{ 
      Thing sample 0013A20040E7782D [ Xbee64BitsAddress="0013A20040E7782D" , IOChannel="123" ]
        /** define things connected to that bridge here */
}

I thing that the best option is to run the discovery. 
amarpulli1994 commented 7 years ago

Hi, @g1velo I did work on Case 1: I will removed the snavxbee2:sample:gateway:0013A20040E7782D end device from the thing file. I did the discovery process to add it again. In this case, it will not send any packets to End Device. here is my log file:

18:00:38.457 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'XbeeDIO11swi
tch' received command ON
18:00:38.560 [INFO ] [marthome.event.ItemStateChangedEvent] - XbeeDIO11switch ch
anged from OFF to ON

Paper UI:

xbee2

Here is both Coordinator and End Device going to be ONLINE state, but SNAVXbee2 ID : 30000 going to be UNINITIALIZED state

SNAVXbee2 ID : 30000 UNINITIALIZED
SNAVXbee2 ID : 30000
snavxbee2:sample:gateway:0013A20040E7782D

My Thing Configuration file in case1:

Bridge snavxbee2:bridge:gateway[ serialPort="COM5",  baudRate=9600 ] 
{ 
      snavxbee2:sample:gateway:0013A20040E7782D
        /** define things connected to that bridge here */
}

Case 2: I did tried to second method also as per your suggested. In this case also, it will not sending any packets to End Device. here is my log file:

18:22:39.075 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'XbeeDIO11swi
tch' received command ON
18:22:39.175 [INFO ] [marthome.event.ItemStateChangedEvent] - XbeeDIO11switch ch
anged from OFF to ON

Here is second case Paper UI

xbee2

In second case End device going to be UNINITIALIZED. But the End Device OH2 Channels are going to be ONLINE state.

My Thing Configuration file in case 2:

Bridge snavxbee2:bridge:gateway[ serialPort="COM5",  baudRate=9600 ] 
{ 
      Thing sample 0013A20040E7782D [ Xbee64BitsAddress="0013A20040E7782D" , IOChannel="123" ]
        /** define things connected to that bridge here */
}

Please let me know the What I can do for sending packets to End Device. Thanks, Amar.

g1velo commented 7 years ago

So let's stick to case 1 using automatic discovery but be sure to clear all Xbee Devices from the thing list before. (except the gateway ). Please use the very last version as I applied some changes to the code.

amarpulli1994 commented 7 years ago

Hi, @g1velo I build the new jar file of last source code. Here is my log file showing like this, while sending packets to End Device .

12:48:50.575 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive
d from 0013A20040E7782D - {[DIO10/PWM0: High]}
12:48:50.575 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - we have to update
snavxbee2:sample:gateway:0013A20040E7782D snavxbee2:sample
12:48:50.576 [TRACE] [snavxbee2.devices.XbeeIOSampleParser] - matched : PWM0DIO1
0 to : PWM0DIO10
12:48:50.576 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - channel to update
: snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10 to value : ON

But I am not able to get any packets at End Device side in XCTU. see as below screen shot

untitled

Any make changes at End Device side in XCTU?

End Device Xbee Ports are:

I/O settings Ports and Configure values :

AD0/DIO0               Commissioning Button[1]
AD1/DIO1               Disabled[0]
AD2/DIO2               Disabled[0]
AD3/DIO3               Disabled[0]
DIO4                       Disabled[0]
DIO5                       Associated indicator[1]
DIO10/PWM0         Digital Out,Low[4]
DIO11                     Disabled[0]
DIO12                     Disabled[0]

Serial Interfacing Ports and Configure values:

DIO6                       Disabled[0]
DIO7                       CTS flow control[1]

Thing file:

Bridge snavxbee2:bridge:gateway[ serialPort="COM5",  baudRate=9600 ] 
{ 
       snavxbee2:sample:gateway:0013A20040E7782D
        /** define things connected to that bridge here */
}

Item file:

Switch XbeeDIO11switch "XbeeDIO11switch " (All) { channel = "snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10" }

Please let me know the how to get the packets at End Device in XCTU. Thanks, Amar.

g1velo commented 7 years ago

Hi, @amarpulli544 From what I see in the logs, it seems to work fine. From the log : 12:48:50.575 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive d from 0013A20040E7782D - {[DIO10/PWM0: High]} Means that the device 0013A20040E7782D has sent a, IOSample packet with the information that DIO10/PWM0 has the value high. So the binding is looking up in the item registry to find an Item matching. in your case :

12:48:50.576 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - channel to update : snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10 to value : ON

So this is a communication from the end device to the coordinator.

If you want to send a command from OH2 to the Xbee device please try : smarthome:send XbeeDIO11switch OFF

wait for the device to send a new sample.

smarthome:send XbeeDIO11switch ON

wait for the device to send a new sample.

This will let you know if the value of XbeeDIO11switch / PWM0DIO10 is changed.

Please let me know !!

amarpulli1994 commented 7 years ago

Hello,@g1velo

Once I send command through Karaf Console, smarthome:send XbeeDIO11switch ON, it is updating only UI and not the End Device. User Interface: light

End Device in XCTU:

untitled

here is my log file:

openhab> smarthome:send XbeeDIO11switch ON
Command has been sent successfully.
16:50:02.294 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - channel to update
: snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10 to value : ON
16:50:07.443 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive
d from 0013A20040E7782D - {[DIO10/PWM0: High]}
16:50:07.443 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - we have to update
snavxbee2:sample:gateway:0013A20040E7782D snavxbee2:sample
16:50:07.443 [TRACE] [snavxbee2.devices.XbeeIOSampleParser] - matched : PWM0DIO1
0 to : PWM0DIO10
16:50:07.443 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - channel to update
: snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10 to value : ON
16:50:10.005 [INFO ] [marthome.event.ItemStateChangedEvent] - ImageURL changed f
rom http://www.fillmurray.com/640/480 to http://www.fillmurray.com/320/240
16:50:17.722 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive
d from 0013A20040E7782D - {[DIO10/PWM0: High]}
16:50:17.722 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - we have to update
snavxbee2:sample:gateway:0013A20040E7782D snavxbee2:sample
16:50:17.722 [TRACE] [snavxbee2.devices.XbeeIOSampleParser] - matched : PWM0DIO1
0 to : PWM0DIO10
16:50:17.723 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - channel to update
: snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10 to value : ON
16:50:20.005 [INFO ] [marthome.event.ItemStateChangedEvent] - ImageURL changed f
rom http://www.fillmurray.com/320/240 to http://www.placecage.com/c/480/360
16:50:22.855 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive
d from 0013A20040E7782D - {[DIO10/PWM0: High]}
16:50:22.856 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - we have to update
snavxbee2:sample:gateway:0013A20040E7782D snavxbee2:sample
16:50:22.856 [TRACE] [snavxbee2.devices.XbeeIOSampleParser] - matched : PWM0DIO1
0 to : PWM0DIO10
16:50:22.856 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - channel to update
: snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10 to value : ON
16:50:27.997 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive
d from 0013A20040E7782D - {[DIO10/PWM0: High]}
16:50:27.997 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - we have to update
snavxbee2:sample:gateway:0013A20040E7782D snavxbee2:sample
16:50:27.998 [TRACE] [snavxbee2.devices.XbeeIOSampleParser] - matched : PWM0DIO1
0 to : PWM0DIO10
16:50:27.998 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - channel to update
: snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10 to value : ON
16:50:30.004 [INFO ] [marthome.event.ItemStateChangedEvent] - ImageURL changed f
rom http://www.placecage.com/c/480/360 to http://www.placecage.com/320/240
16:50:31.916 [INFO ] [marthome.event.ItemStateChangedEvent] - CurrentDate change
d from 2017-02-21T16:49:31.913+0530 to 2017-02-21T16:50:31.915+0530
16:50:33.139 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive
d from 0013A20040E7782D - {[DIO10/PWM0: High]}
16:50:33.139 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - we have to update
snavxbee2:sample:gateway:0013A20040E7782D snavxbee2:sample
16:50:33.139 [TRACE] [snavxbee2.devices.XbeeIOSampleParser] - matched : PWM0DIO1
0 to : PWM0DIO10
16:50:33.139 [TRACE] [xbee2.handler.SNAVXbee2BridgeHandler] - channel to update
: snavxbee2:sample:gateway:0013A20040E7782D:PWM0DIO10 to value : ON

Thanks, Amar

g1velo commented 7 years ago

Amar,

16:50:07.443 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive d from 0013A20040E7782D - {[DIO10/PWM0: High]}

mean that the DIO10/PWM0: value is High / ON

please try the OFF command and wait for a new sample to be sent by the end device

smarthome:send XbeeDIO11switch OFF

amarpulli1994 commented 7 years ago

@g1velo

Just now I did check the both cases:

  1. smarthome:send XbeeDIO11switch ON , it has been working fine as per you saying, the values is DIO10/PWM0: value is High

    16:50:07.443 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive
    d from 0013A20040E7782D - {[DIO10/PWM0: High]}
  2. smarthome:send XbeeDIO11switch OFF, the values is DIO10/PWM0: value is Low

16:50:07.443 [DEBUG] [xbee2.handler.SNAVXbee2BridgeHandler] - New sample receive
d from 0013A20040E7782D - {[DIO10/PWM0: Low]}

Thanks, Amar.

amarpulli1994 commented 7 years ago

Hi ,@g1velo I am trying to do adding new channels in thing-types.xml file under org.openhab.binding.snavxbee2/ESH-INF/thing/thing-types.xml. Because my xbee device contains a DIO13 and DIO14 ports . Is there any possible to add channels? Please let me know the what I can do. Thanks, Amar

g1velo commented 7 years ago

I can do this quite quickly, please open a new issue. need to update thing-types.xml and SNAVXbee2BindingConstants