Hi Mind hive,
I have put in my mind to migrate my home automation from Souliss to MySensors, and i am setting up a testlab. I have a RS485 line running through my house, and i want to re-use it.
In my test setup i have installed a clean OH 2.5.9 (on windows).
i've built an ethernet gateway on a mega2560 with RS485 shield (built myself, based on SN75176 transceiver)
The ethernet gateway compiled without errors. this is the sketch (grabbed from examples and edited to the needs of an ethernet/RS485 network)
// Enable debug prints to serial monitor
#define MY_DEBUG
//#define MY_DEBUG_HWSERIAL Serial1 // = Serial0 / Rx0 & Tx0 to programming & debug
// Enable RS485 transport layer
#define MY_RS485
// Define this to enables DE-pin management on defined pin
#define MY_RS485_DE_PIN 2
// Set RS485 baud rate to use
#define MY_RS485_BAUD_RATE 9600
// Enable this if RS485 is connected to a hardware serial port
#define MY_RS485_HWSERIAL Serial3
// Enable gateway ethernet module type
#define MY_GATEWAY_W5100
// W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
#define MY_W5100_SPI_EN 4
// Enable UDP communication
//#define MY_USE_UDP // If using UDP you need to set MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS below
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
#define MY_IP_ADDRESS 192,168,80,185
// If using static ip you can define Gateway and Subnet address as well
#define MY_IP_GATEWAY_ADDRESS 192,168,80,1
#define MY_IP_SUBNET_ADDRESS 255,255,255,0
// Renewal period if using DHCP
//#define MY_IP_RENEWAL_INTERVAL 60000
// The port to keep open on node server mode / or port to contact in client mode
#define MY_PORT 5003
// Controller ip address. Enables client mode (default is "server" mode).
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
#define MY_CONTROLLER_IP_ADDRESS 192, 168, 80, 190
//#define MY_CONTROLLER_URL_ADDRESS "my.controller.org"
// The MAC address can be anything you want but should be unique on your network.
// Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
// Note that most of the Arduino examples use "DEAD BEEF FEED" for the MAC address.
#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xF1, 0x00
// Enable inclusion mode
#define MY_INCLUSION_MODE_FEATURE
// Enable Inclusion mode button on gateway
//#define MY_INCLUSION_BUTTON_FEATURE
// Set inclusion mode duration (in seconds)
#define MY_INCLUSION_MODE_DURATION 60
// Digital pin used for inclusion mode button
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
// Set blinking period
#define MY_DEFAULT_LED_BLINK_PERIOD 300
// Flash leds on rx/tx/err
// Uncomment to override default HW configurations
//#define MY_DEFAULT_ERR_LED_PIN 7 // Error led pin
//#define MY_DEFAULT_RX_LED_PIN 8 // Receive led pin
//#define MY_DEFAULT_TX_LED_PIN 9 // Transmit led pin
#if defined(MY_USE_UDP)
#include <EthernetUdp.h>
#endif
#include <Ethernet.h>
#include <MySensors.h>
void setup()
{
// Setup locally attached sensors
}
void presentation()
{
// Present locally attached sensors here
}
void loop()
{
// Send locally attached sensors data here
}
I hope that's well done for an ethernet to RS485 gateway.
The debug output of the GW says this:
17:21:03.768 -> 0 MCO:BGN:INIT GW,CP=RSNGA---,FQ=16,REL=255,VER=2.3.2
17:21:03.803 -> 4 TSM:INIT
17:21:03.803 -> 5 TSF:WUR:MS=0
17:21:03.803 -> 7 TSM:INIT:TSP OK
17:21:03.803 -> 8 TSM:INIT:GW MODE
17:21:03.803 -> 10 TSM:READY:ID=0,PAR=0,DIS=0
17:21:03.803 -> 12 MCO:REG:NOT NEEDED
17:21:04.370 -> 575 GWT:TIN:IP=192.168.80.185
17:21:06.386 -> 2580 !GWT:TIN:ETH FAIL
17:21:06.386 -> 2582 MCO:BGN:STP
17:21:06.386 -> 2584 MCO:BGN:INIT OK,TSP=1
17:21:07.410 -> 3588 !GWT:TSA:ETH FAIL
17:21:07.410 -> 3590 TSM:READY:NWD REQ
17:21:07.410 -> 3608 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
17:21:08.428 -> 4616 !GWT:TSA:ETH FAIL
17:21:09.448 -> 5619 !GWT:TSA:ETH FAIL
17:21:10.447 -> 6623 !GWT:TSA:ETH FAIL
Which also doesn't seem wrong to me since the gateway doesn't find a controller.
Enter the controller: Openhab 2.5.9.
Installed the binding by adding it in the addons folder.
openhab> bundle:list | grep MySensors
210 │ Installed │ 80 │ 2.5.0.202002161928 │ openHAB Add-ons :: Bundles :: MySensors Binding
Binding shows as installed - but not active.
I added a demo.things file in the things folder:
Bridge mysensors:bridge-eth:gateway [ ipAddress="192.168.80.185", tcpPort=5003, sendDelay=200 ] {
/** define things connected to that bridge here */
}
And that's where i am stuck.
Q1: how to get the binding 'active' ? any ideas?
Q2: how to get autodiscovery working once the binding is active? Is this actually implemented? I only see examples with textual configuration.
openhab.log shows this, by the way:
2020-10-20 17:04:29.689 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'demo.things'
2020-10-20 17:04:30.659 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2020-10-20 17:04:31.224 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.80.190:8080
2020-10-20 17:04:31.299 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.80.190:8443
2020-10-20 17:04:31.643 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2020-10-20 17:04:31.674 [INFO ] [ebuilder.internal.HomeBuilderServlet] - Started Home Builder at /homebuilder
2020-10-20 17:04:31.708 [INFO ] [openhab.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2020-10-20 17:04:33.910 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/C:/OH25/addons/org.openhab.binding.mysensors-2.5.0-SNAPSHOT%20(1).jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [210]
Unresolved requirement: Import-Package: org.eclipse.smarthome.io.transport.mqtt
at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]
Thanks People