Hi
Please check this http://forum.mysensors.org/topic/1543/universal-gateway-for-315-433mhz-devices/2
Is there anyway to use directly 433 with openhab --- serial gateway will be 433 receiver and transmitter (without mysensors lib and devices)
Hi
Please check this http://forum.mysensors.org/topic/1543/universal-gateway-for-315-433mhz-devices/2
Is there anyway to use directly 433 with openhab --- serial gateway will be 433 receiver and transmitter (without mysensors lib and devices)
Is there anyway to use directly 433 with openhab --- serial gateway will be 433 receiver and transmitter (without mysensors lib and devices)
@static418 Thank you for your idea.
Create 2 maps, if one is null then get other map.
I removed ";" things because i dont need them.
var HashMap<String, String> CodeToItemsMapOn = newLinkedHashMap(
"14013452"->"SOKET_1",
"SOKET_1"->"14013452"
)
var HashMap<String, String> CodeToItemsMapOff = newLinkedHashMap(
"14013443"->"SOKET_1",
"SOKET_1"->"14013443"
)
var HashMap<String, String> CodeToActionMap = newLinkedHashMap( //nothing important because there is no duplicate
"14013452"->"ON",
"ON"->"14013452",
"14013443"->"OFF",
"OFF"->"14013443"
)
//remember hashmaps must be out of the rule
rule "Arduino sends to Openhab"
when
Item Arduino received update
then
.........
if(subType==V_VAR1){
var myOrder=CodeToItemsMapOn.get(msg) //1.map
if(myOrder==null){myOrder=CodeToItemsMapOff.get(msg)} //2.map
postUpdate(myOrder,CodeToActionMap.get(msg)) //make you job
}
.......
end
This code is only for updating the openhab screen (receiving), i will work for transmit.
You can find more on https://github.com/openhab/openhab/wiki/Taking-Rules-to-New-Heights
There is another problem with CodeToActionMap; If i got a lot of outlets this means many on and off commands ..
rule "MY ON"
when
Item SOKET_1 received command ON
then
sendCommand(Arduino, "105;105;1;0;24;" + 14013452 + "\n")
end
rule "MY OFF"
when
Item SOKET_1 received command OFF
then
sendCommand(Arduino, "105;0;1;0;24;" + 14013443 + "\n")
end`
These rules for TRANSMIT didnt work any idea???
@TimO ok 2.0 alpha...
An idea for 1.x; Ready-Discovery ?
We write 250 mysensors items like ID=1-30 for switches, 31-50 for contacts, 51-70 for motion etc... if item is available then sitemap will show them.
Is there anyway to create rules on frontend? Maybe IFTTT + MySensors goes well..
@TimO Hi do you work with Openhab 2.0? I tried to install it and couldnt create a binding, its very hard for me. I need auto Discovery of mysensors with 2.0
@quocanhcgd Can you share the A/C dimmer design?
Awesome work!
@l154 How can user give item name? Where is discovered device in the UI?
Detailed information about discovered device on single node are in SITEMAP_mysensors_nodeId.html location OPENHAB_WEBAPPS ---- not implemented yet
When will you put this file?
Maybe some screenshots explain better..
2015-04-16 12:06:00.214 [WARN ] [m.r.i.engine.RuleContextHelper] - Variable 'itemsAll' on rule file 'default.rules' cannot be initialized with value '.toString': An error occured during the script execution: The name 'all' cannot be resolved to an item or type.
2015-04-16 12:06:05.746 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;read: 51-51-0 s=1,c=1,t=2,pt=2,l=2:0
51;1;1;0;2;0
2015-04-16 12:06:06.263 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Arduino sends to Openhab': The name '.get()' cannot be resolved to an item or type.
@tim @hek
Hek adviced me to download current 1.4 v in a topic and i did. I was using 1.4 which downloaded 2 months ago.
After that;
My old node's sketch(or api) was not the same with my new serial controller sketch 1.4
I reupload sketches to every node and gateway still I am not sure with this solution but today my nodes worked fine.
How do you seperate relay power?
What is your solution to drop 220v AC to 5v DC?
@hek do you have any plan to use this logic in new version api?
@Anticimex awesome work!
@TimO I think so maybe rpi usb problem...
Is there a newer file for org.openhab.binding.serial_1.6.0.201411271703
@celonunes @hek
I installed this https://github.com/lurch/rpi-serial-console
pi@raspberrypi ~ $ rpi-serial-console status
Serial console on /dev/ttyAMA0 is disabled
Now my nodes are working perfect when i use manual button or ui but my logs are not correct
My config:
add on : org.openhab.binding.serial_1.6.0.201411271703.jar
String Arduino "Arduino" { serial="/dev/ttyUSB0" }
As you see there are "fails" but nodes are working.
015-03-09 12:37:51.725 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;send: 0-0-52-52 s=1,c=1,t=2,pt=0,l=1,st=fail:1
2015-03-09 12:37:56.726 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;read: 52-52-0 s=255,c=0,t=18,pt=0,l=5:1.4.1
52;255;0;0;18;1.4.1
0;0;3;0;9;read: 52-52-0 s=255,c=3,t=6,pt=1,l=1:0
52;255;3;0;6;0
2015-03-09 12:37:58.768 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;read: 52-52-0 s=255,c=3,t=11,pt=0,l=14:Relay & Button
52;255;3;0;11;Relay & Button
0;0;3;0;9;read: 52-52-0 s=255,c=3,t=12,pt=0,l=3:1.0
52;255;3;0;12;1.0
0;0;3;0;9;read: 52-52-0 s=1,c=0,t=3,pt=0,l=5:1.4.1
52;1;0;0;3;1.4.1
0;0;3;0;9;read: 52-52-0 s=2,c=0,t=3,pt=0,l=5:1.4.1
52;2;0;0;3;1.4.1
2015-03-09 12:37:59.700 [INFO ] [runtime.busevents ] - S2 received command ON
2015-03-09 12:37:59.822 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;0
2015-03-09 12:38:00.106 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;send: 0-0-52-52 s=1,c=1,t=2,pt=0,l=1,st=fail:0
2015-03-09 12:38:00.546 [INFO ] [runtime.busevents ] - S2 received command OFF
2015-03-09 12:38:00.661 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;1
2015-03-09 12:38:00.967 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;send: 0-0-52-52 s=1,c=1,t=2,pt=0,l=1,st=fail:1
2015-03-09 12:38:01.161 [INFO ] [runtime.busevents ] - S2 received command ON
2015-03-09 12:38:01.339 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;0
2015-03-09 12:38:01.649 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;send: 0-0-52-52 s=1,c=1,t=2,pt=0,l=1,st=fail:0
2015-03-09 12:38:01.782 [INFO ] [runtime.busevents ] - S2 received command OFF
2015-03-09 12:38:01.894 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;1
2015-03-09 12:38:02.076 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;send: 0-0-52-52 s=1,c=1,t=2,pt=0,l=1,st=fail:1
I installed this https://github.com/lurch/rpi-serial-console
pi@raspberrypi ~ $ rpi-serial-console status
Serial console on /dev/ttyAMA0 is disabled
Now my nodes are working perfect when i use manual button or ui but my logs are not correct
My config:
add on : org.openhab.binding.serial_1.6.0.201411271703.jar
String Arduino "Arduino" { serial="/dev/ttyUSB0" }
As you see there are "fails" but nodes are working.
015-03-09 12:37:51.725 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;send: 0-0-52-52 s=1,c=1,t=2,pt=0,l=1,st=fail:1
2015-03-09 12:37:56.726 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;read: 52-52-0 s=255,c=0,t=18,pt=0,l=5:1.4.1
52;255;0;0;18;1.4.1
0;0;3;0;9;read: 52-52-0 s=255,c=3,t=6,pt=1,l=1:0
52;255;3;0;6;0
2015-03-09 12:37:58.768 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;read: 52-52-0 s=255,c=3,t=11,pt=0,l=14:Relay & Button
52;255;3;0;11;Relay & Button
0;0;3;0;9;read: 52-52-0 s=255,c=3,t=12,pt=0,l=3:1.0
52;255;3;0;12;1.0
0;0;3;0;9;read: 52-52-0 s=1,c=0,t=3,pt=0,l=5:1.4.1
52;1;0;0;3;1.4.1
0;0;3;0;9;read: 52-52-0 s=2,c=0,t=3,pt=0,l=5:1.4.1
52;2;0;0;3;1.4.1
2015-03-09 12:37:59.700 [INFO ] [runtime.busevents ] - S2 received command ON
2015-03-09 12:37:59.822 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;0
2015-03-09 12:38:00.106 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;send: 0-0-52-52 s=1,c=1,t=2,pt=0,l=1,st=fail:0
2015-03-09 12:38:00.546 [INFO ] [runtime.busevents ] - S2 received command OFF
2015-03-09 12:38:00.661 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;1
2015-03-09 12:38:00.967 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;send: 0-0-52-52 s=1,c=1,t=2,pt=0,l=1,st=fail:1
2015-03-09 12:38:01.161 [INFO ] [runtime.busevents ] - S2 received command ON
2015-03-09 12:38:01.339 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;0
2015-03-09 12:38:01.649 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;send: 0-0-52-52 s=1,c=1,t=2,pt=0,l=1,st=fail:0
2015-03-09 12:38:01.782 [INFO ] [runtime.busevents ] - S2 received command OFF
2015-03-09 12:38:01.894 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;1
2015-03-09 12:38:02.076 [INFO ] [runtime.busevents ] - Arduino state updated to 0;0;3;0;9;send: 0-0-52-52 s=1,c=1,t=2,pt=0,l=1,st=fail:1
@celonunes generally raspberry pi with serial usb but also you can see some mqtt logs. Same problem with mac os with serial usb.
I also tried rpi uart pins for serial bu there is no logs for it.
Maybe someone gives his Openhab dir i can understand better problem isnt related with hardware
Restarting the modem and checking wires of arduino solved my problem before.
I am sure mqtt have to be in dhcp list.
@hooraysimpsons unplug the power and restart your modem, check your dhcp menu if it has ip for Ardiuno.
Check your mqtt from serial monitor, you must see "gateway started..."
@hek My relay powered from nano icp headers maybe this makes trouble for wifi , i will change this and give update.
My button is not normal button , its an ir distance sensor which trigers the relay.
@TimO please can you share Openhab files?
+My relay powered from nano icp headers maybe this makes trouble for wifi , i will change this and give update.
@Jan-Gatzke said:
ttyAMA0
:+1:
What version openhab runtime and add ons do you use?
How many nodes do you have and how long time they are working fine without restart rpi?
Please can you upload your config files?
1.6.2 or 1.7.0 didn't switch on-off my relays but logs seems ok:
I connected nano pins VIN+GND+TX+RX to RPI 5V+GND+TX+RX , (TX->TX , RX->RX)
osgi> 2015-03-07 15:49:24.409 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v1.7.0).
2015-03-07 15:49:50.387 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mDNS service has been started
2015-03-07 15:49:51.200 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Service Discovery initialization completed.
2015-03-07 15:50:01.540 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'default.items'
2015-03-07 15:50:15.506 [WARN ] [cpr.DefaultAnnotationProcessor] - Unable to detect annotations. Application may fail to deploy.
2015-03-07 15:50:17.567 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'default.sitemap'
2015-03-07 15:50:32.786 [INFO ] [penhab.io.rest.RESTApplication] - Started REST API at /rest
2015-03-07 15:50:38.947 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /openhab.app
2015-03-07 15:50:51.918 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'default.rules'
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyAMA0
2015-03-07 15:51:01.398 [INFO ] [.service.AbstractActiveService] - NTP Refresh Service has been started
2015-03-07 15:51:57.516 [INFO ] [runtime.busevents ] - S2 received command ON
2015-03-07 15:52:08.006 [INFO ] [runtime.busevents ] - S2 received command OFF
2015-03-07 15:52:11.408 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;0
2015-03-07 15:52:11.722 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;1
2015-03-07 15:52:19.544 [INFO ] [runtime.busevents ] - S1 received command ON
2015-03-07 15:52:21.200 [INFO ] [runtime.busevents ] - Arduino received command 51;1;1;0;2;0
2015-03-07 15:52:22.143 [INFO ] [runtime.busevents ] - S2 received command ON
2015-03-07 15:52:22.259 [INFO ] [runtime.busevents ] - Arduino received command 52;1;1;0;2;0
2015-03-07 15:52:23.131 [INFO ] [runtime.busevents ] - AP3 received command ON
2015-03-07 15:52:24.142 [INFO ] [runtime.busevents ] - Arduino received command 100;3;1;0;0;1
@celonunes You can find MQTT and serial logs in the zip files openhab 1.6.2 and 1.7.0 logs-1.7.0.zip logs-1.6.2.zip
@hek My nodes are working perfect when i only plug serial usb to any usb socket of a computer-printer-usb hub even a mobile phone charger :) they are good without server/controller
@GuyP
You can find MQTT and serial logs in the zip files openhab 1.6.2 and 1.7.0 logs-1.7.0.zip logs-1.6.2.zip