Hi,
I'm starting to write a plugging output serial data through an EnOcean USB300.
I will, and I have already met some trouble with coding this plugin. I decided to start this topic for who may want to help.
- Spoiler: show
- Please Help !

@Dnpwwo generously send me a template to start this plugin. see :
https://www.domoticz.com/forum/viewtopi ... 61&t=16545
1 -
- Spoiler: show
- First problem I met is setting the baudrate :
I replace Code: Select all
Domoticz.Transport("Serial", Parameters["SerialPort"], 115200)
with Code: Select all
Domoticz.Transport("Serial", Parameters["SerialPort"], "57600")
Because the 3rd input requiered a string not a int. And the USB300 works at 58823.
But in the log I get : Code: Select all
Transport set to: 'Serial', 'COM3', 115200.
How can I change the baudrate to 57600 ?
Solve : Code: Select all
Domoticz.Transport("Serial", Parameters["SerialPort"], Baud=57600)
2 -
- Spoiler: show
Code: Select all
def onMessage(Data, Status, Extra):
Domoticz.Log("onMessage called")
splittedData = Data.split()
Verify = Data[1]
Domoticz.log(str(splittedData))
Domoticz.Log("onMessage called2")
Domoticz.log(str(Verify))
Domoticz.Log("onMessage called3")
In the windows console, I get the following error :
Code: Select all
Error: <EnOcean_Debug> 'onMessage' failed 'AttributeError':'module 'Domoticz' has no attribute 'log''.
and domoticz crashed crash
But I know it has. Why does it lie to me
?
Solve : (Thanks zak45) Log and not log

3 - With this plugin, I will use the USB300 on port COM3. A problem comes when I also want to use the included ESP3 harware "EnOcean USB (ESP3) with the same port. Is there a way to do this ?
I was thinking to open port of my plugin only when I need to send specific data through USB300 (not handle with the EnOcean USB Domo...) and then give back the port to the native EnOcean USB domoticz driver. All messagse received by the EnOcean USB domoticz driver are in the log.
Is this solution seems possible to you ? It will requiere to read the log file