Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Secant Cardio IIè Home Automation Central Unit RS-232 integration #151

Closed
openhab-bot opened this issue Nov 17, 2013 · 88 comments
Closed

Comments

@openhab-bot
Copy link
Collaborator

openhab-bot commented Nov 17, 2013

From [email protected] on November 19, 2012 13:30:10

  1. I have a Secant Cardio IIè Home Automation Central Unit, and I want to build a KNX gateway to extend its possibilities. I know Secant RS-232 ASCII protocol and I wish to contribute to develop a plugin in order to integrate with KNX and other systems using openhab. How can we colaborate?
  2. Example: I want to turn on/off KNX controlled devices by Cardio Touch Screen, or enable Cardio security from a KNX device.

Original issue: http://code.google.com/p/openhab/issues/detail?id=151

@openhab-bot
Copy link
Collaborator Author

From kai.openhab on November 19, 2012 14:15:50

Have a look at http://code.google.com/p/openhab/wiki/HowToContribute We currently do not have specific documentation on how to implement a binding - for the moment the best way is therefore to have a look at how other bindings work and learn from it. Feel free to ask questions in the forum.

@openhab-bot
Copy link
Collaborator Author

From [email protected] on November 21, 2012 00:58:16

O.K.
I have prepared a linux VM with OpenJDK, Maven, Mercurial, Eclipse and Eclipse's App for Maven & Mercurial integration.
I synced "default" branch of openhab by Eclipse Mercurial integration App, and now, I can view openhab Maven structure contents.
What's the next step?

P.D. I attached Secant Cardio RS-232 ASCII protocol specs doc.

Attachment: Cardio-Communication-Protocol-Secant-2-Rev-1-0-En-2.pdf

@openhab-bot
Copy link
Collaborator Author

From [email protected] on November 21, 2012 23:36:16

Excuse me. My English is not the good enought.

I had a look at openhab code, and I didn't know how to start encoding binding.
Really... I didn't ever installed or run oponhub, so I don't sure to know how it works and how it can be configured. I am still reading your wiki and trying to understund it.
But at the day of today, I don't yet understand the project structure, and my knowledge on Java and Maven is limited.
Could you help me?
Could an openhub project developer start writting the binding? So I will can understand how it is written, and I will can replicate program structures and complete and test it.
Thank you very much.

@openhab-bot
Copy link
Collaborator Author

From kai.openhab on November 24, 2012 13:13:54

Thomas is working on a Maven archetype, which creates a binding skeleton as a starting point for a new binding. Furthermore we will work on a wiki page that explains the main points about writing a binding. If you can wait for a few more weeks, these things might help you to get a start.

@openhab-bot
Copy link
Collaborator Author

From [email protected] on November 25, 2012 23:11:19

That is great!
Of course... I can wait.
Thank you very much.

@openhab-bot
Copy link
Collaborator Author

From teichsta on April 30, 2013 07:52:39

fyi: the maven archetype is available meanwhile. See http://code.google.com/p/openhab/source/browse/bundles/archetype/org.openhab.archetype.binding/README.txt for details who to use it.

@openhab-bot
Copy link
Collaborator Author

From [email protected] on May 08, 2013 02:20:55

I can not build the maven archetype. The openHAB version in mercurial repository is 1.3.0-SNAPSHOT, and maven metadata found is for 1.2.0-SNAPSHOT.

@openhab-bot
Copy link
Collaborator Author

From teichsta on May 21, 2013 14:29:24

Owner: ---

@openhab-bot
Copy link
Collaborator Author

From [email protected] on June 25, 2013 00:56:21

I can still not build binding.
I attached the binding by maven archetype generation error log file.

Attachment: mvn archetype generate error log.txt

@openhab-bot
Copy link
Collaborator Author

From teichsta on June 25, 2013 11:39:56

i updated the version of the pom and removed the hardcoded bundle-version in MANIFEST.MF could you try again?

you should also use an capitalised binding name, since this name is used to generate the new classes. The get's lowercased where it's needed. The call should look like this (after installing the artifact to your local mvn repository).

mvn archetype:generate -B -DarchetypeGroupId=org.openhab.archetype -DarchetypeArtifactId=org.openhab.archetype.binding -DarchetypeVersion=1.3.0-SNAPSHOT -Dauthor="Manuel Alberto Guerrero Díaz" -Dversion=1.3.0 -DartifactId=org.openhab.binding.cardio2e -Dpackage=org.openhab.binding.cardio2e -Dbinding-name=Cardio2e -X -e

Hope this helps,

Thomas E.-E.

@openhab-bot
Copy link
Collaborator Author

From [email protected] on June 26, 2013 05:02:39

Thanks for your answer.
I used an capitalised binding name, such you suggested.
Generation still fails.
I attached generation log.

Attachment: mvn archetype generate error log 2.txt

@openhab-bot
Copy link
Collaborator Author

From teichsta on June 26, 2013 05:55:23

hm, that works me. Did you issue an "mvn clean install" in the directory:

/openhab/bundles/archetype/org.openhab.archetype.binding

@openhab-bot
Copy link
Collaborator Author

From [email protected] on July 10, 2013 03:21:57

Sorry. Excuse me, but I still can not to build archetype.
I made "mvn clean install" as you suggested and tried again: ERROR.

I attached last error log.

Attachment: mvn archetype generate error log 3..txt

@openhab-bot
Copy link
Collaborator Author

From teichsta on July 10, 2013 05:43:02

Please follow the following steps:

  • go to your local openHAB clone and call 'hg pull -u'
  • go to /openhab/bundles/archetype/org.openhab.archetype.binding and call 'mvn clean install'
  • go to /openhab/bundles/bindings and call 'mvn archetype:generate ...'
  • If that doesn't work please move your local repo (/home/openhab/.m2) to .m2_old and start from the top
  • If that still doesn't work check out the sources again and start from the top

@openhab-bot
Copy link
Collaborator Author

From [email protected] on October 08, 2013 06:04:19

Excuse me. I had a lot of job and can not do a new try before.

I exactly did wiki instructions in a clean new OpenSuSE 12.3 x64 virtual machine with Oracle Java 1.7.0u40 JDK, lasted Yoxos 5.6 openHab Eclipse IDE and lastest Maven 3.1.0 installed.
I cloned lastest project from new GIT 1.4.0-SNAPSHOT repository into ~/workspace/openhab.
I removed ~/m2 directory (not exist yet)
I executed "maven clean install" in ~/workspace/openhab/bundles/archetype/org.openhab.archetype.binding -> SUCESS
I executed "mvn archetype:generate -B -DarchetypeGroupId=org.openhab.archetype -DarchetypeArtifactId=org.openhab.archetype.binding -DarchetypeVersion=1.3.0-SNAPSHOT -Dauthor="Manuel Alberto Guerrero Díaz" -Dversion=1.3.0 -DartifactId=org.openhab.binding.cardio2e -Dpackage=org.openhab.binding.cardio2e -Dbinding-name=Cardio2e -X -e" in ~/workspace/openhab/bundles/binding -> FAILED

I surrender. Can not build archetype. And I cannot attach lastest mvn archetype generate error log: Issue attachment storage quota exceeded.

@openhab-bot
Copy link
Collaborator Author

From kai.openhab on October 12, 2013 12:39:40

Try now with the very latest version on GitHub and version 1.4.0-SNAPSHOT - I have just pulled a change to fix the archetypes: #37

@openhab-bot
Copy link
Collaborator Author

From teichsta on November 05, 2013 14:47:54

Labels: To-Github

@teichsta teichsta reopened this Dec 8, 2013
@magd1978
Copy link
Contributor

Thank you for reopen te issue.
I will try again to clean environment, to clone git repository, to make maven clean install and to generate archetype.

@magd1978
Copy link
Contributor

Generation sucessfully!!! Thank you at all!! Next step: to write the binding...

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] openHAB Bindings .................................. SUCCESS [5.124s]
[INFO] openHAB Bluetooth Binding ......................... SKIPPED
[INFO] openHAB KNX Binding ............................... SKIPPED
[INFO] openHAB KNX Binding Tests ......................... SKIPPED
[INFO] openHAB Serial Binding ............................ SKIPPED
[INFO] openHAB 1-Wire Binding ............................ SKIPPED
[INFO] openHAB Wake-on-LAN binding ....................... SKIPPED
[INFO] openHAB NetworkHealth Binding ..................... SKIPPED
[INFO] openHAB Exec Binding .............................. SKIPPED
[INFO] openHAB Exec Binding Tests ........................ SKIPPED
[INFO] openHAB HTTP Binding .............................. SKIPPED
[INFO] openHAB HTTP Binding Tests ........................ SKIPPED
[INFO] openHAB Hue Binding ............................... SKIPPED
[INFO] openHAB Fritzbox Binding .......................... SKIPPED
[INFO] openHAB NTP Binding ............................... SKIPPED
[INFO] openHAB MPD Binding ............................... SKIPPED
[INFO] openHAB VDR Binding ............................... SKIPPED
[INFO] openHAB Asterisk Binding .......................... SKIPPED
[INFO] openHAB SNMP Binding .............................. SKIPPED
[INFO] openHAB Sonos Binding ............................. SKIPPED
[INFO] openHAB ConfigAdmin Binding ....................... SKIPPED
[INFO] openHAB Novelan Heatpump Binding .................. SKIPPED
[INFO] openHAB Cups Binding .............................. SKIPPED
[INFO] openHAB IHC / ELKO LS Binding ..................... SKIPPED
[INFO] openHAB TCP/UDP Binding ........................... SKIPPED
[INFO] openHAB Plugwise Binding .......................... SKIPPED
[INFO] openHAB Modbus Binding ............................ SKIPPED
[INFO] openHAB PLCBus Binding ............................ SKIPPED
[INFO] openHAB DMX Binding ............................... SKIPPED
[INFO] openHAB OLA inteface for DMX Binding .............. SKIPPED
[INFO] openHAB lib485 interface for DMX Binding .......... SKIPPED
[INFO] openHAB artnet interface for DMX Binding .......... SKIPPED
[INFO] openHAB DMX Binding Tests ......................... SKIPPED
[INFO] openHAB RFXCOM Binding ............................ SKIPPED
[INFO] openHAB Samsung TV Binding ........................ SKIPPED
[INFO] openHAB Pulseaudio Binding ........................ SKIPPED
[INFO] openHAB Homematic Binding ......................... SKIPPED
[INFO] openHAB Homematic Binding Tests ................... SKIPPED
[INFO] openHAB Koubachi Binding .......................... SKIPPED
[INFO] openHAB Onkyo Binding ............................. SKIPPED
[INFO] openHAB OpenPaths Binding ......................... SKIPPED
[INFO] openHAB Somfy URTSI II Binding .................... SKIPPED
[INFO] openHAB OpenSprinkler Binding ..................... SKIPPED
[INFO] openHAB Epson projector Binding ................... SKIPPED
[INFO] openHAB ComfoAir Binding .......................... SKIPPED
[INFO] openHAB OWServer Binding .......................... SKIPPED
[INFO] openHAB DigitalSTROM Binding ...................... SKIPPED
[INFO] openHAB Squeezebox Binding ........................ SKIPPED
[INFO] openHAB MQTT Binding .............................. SKIPPED
[INFO] openHAB mqtt Binding Tests ........................ SKIPPED
[INFO] openHAB Mqttitude Binding ......................... SKIPPED
[INFO] openHAB Milight Binding ........................... SKIPPED
[INFO] openHAB Systeminfo Binding ........................ SKIPPED
[INFO] openHAB Piface Binding ............................ SKIPPED
[INFO] openHAB Fritz AVM Home Automation Binding ......... SKIPPED
[INFO] openHAB Tinkerforge Binding ....................... SKIPPED
[INFO] openHAB Nibe heat pump Binding .................... SKIPPED
[INFO] openHAB ZWave Binding ............................. SKIPPED
[INFO] openHAB Nikobus Binding ........................... SKIPPED
[INFO] openHAB Nikobus Binding Tests ..................... SKIPPED
[INFO] openHAB EnOcean Binding ........................... SKIPPED
[INFO] openHAB enocean Binding Tests ..................... SKIPPED
[INFO] openHAB Swegon ventilation Binding ................ SKIPPED
[INFO] openHAB MaxCube Binding ........................... SKIPPED
[INFO] openHAB MAX!Cube Binding Tests .................... SKIPPED
[INFO] openHAB tivo Binding .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:55.656s
[INFO] Finished at: Thu Dec 12 11:19:09 CET 2013
[INFO] Final Memory: 175M/495M
[INFO] ------------------------------------------------------------------------

@sja
Copy link
Contributor

sja commented Jan 14, 2015

Whats the state of this binding? Have you made any progress?

@teichsta
Copy link
Member

since there were for more than one year i'd like to close this issue soon …

@magd1978
Copy link
Contributor

Sorry. I have had no time to develop the binding.

I'm sketched the schema of the class that it should encode / decode the RS-232 stream, but I don't have a finish date.

If you must to close... O.K. I will understand. When the main classes will be completed, I will contact you again to resume binding, and then I will ask for you help to complete binding.

Thank you very much for your patience.

@magd1978
Copy link
Contributor

On the other hand , if another contributor who has time can program the code , I could collaborate doing necessary testing and final adjustments.
I can send you an official PDF document with Cardio IIè RS-232 protocol.

@magd1978
Copy link
Contributor

Some progress...
I just sucessfully sent commands from a java testing enviroment to Cardio without Cardio hungs. I also recived Cardio responses.
Next step: encode / decode Cardio telegrams and parsing to structured data.

@magd1978
Copy link
Contributor

magd1978 commented Mar 2, 2015

More progress...
Completed encode / decode Cardio telegrams and parsing to structured data.
Next step: connect to openhub bus.

@ericc514
Copy link

Reinstalled everything (OS/openHab2/compatibility/etc) I added the conf elements. Everything seems to load (no habla Espanol ;-) and I'm not getting any errors. How do I know if the binding loads properly, as I believe the binding won't show under Paper UI?

@magd1978
Copy link
Contributor

magd1978 commented May 17, 2017

Sorry for the inconvenience. The demo is based on an extract from my openhab config. The descriptions are in Spanish because I have not had time to translate it. However, it is only a example. Yesterday even, in the hurry, I put part of my message in Spanish, and when I realized, I edited it to translate it. :-D

About binding messages: if you change the value of an item assigned to the binding (example off -> on) an error should appear in the log if Cardio is not connected or login failed. And if it is connected, and the installer code setup is correct, "Cardio 2é login suceed" and other messages should be displayed indicating that commands are being sent to Cardio send queue.

It seems that the level of detail of the openHab 2 log is reduced by default. In openHab 1, in debug mode, you can see messages from the binding indicating the values read from openhab.cfg and other initialization messages.

I would like more time to fine-tune all these details. But everything will come. I intend to finish it as soon as possible.

Thanks for your patience.

P.D.: You can list binding status typing "bundle:list" in the Karaf console (see http://docs.openhab.org/administration/bundles.html)

@ericc514
Copy link

ericc514 commented May 17, 2017 via email

@ericc514
Copy link

success. console reports:

12:42:15.303 [DEBUG] [org.openhab.binding.cardio2e        ] - BundleEvent STARTING - org.openhab.binding.cardio2e
12:42:15.314 [DEBUG] [org.openhab.binding.cardio2e        ] - BundleEvent STARTED - org.openhab.binding.cardio2e
12:42:15.329 [DEBUG] [org.openhab.binding.cardio2e        ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.cardio2e.Cardio2eBindingProvider}={component.name=org.openhab.binding.cardio2e.genericbindingprovider, component.id=193, service.id=320, service.bundleid=209, service.scope=bundle} - org.openhab.binding.cardio2e
12:42:15.576 [DEBUG] [org.openhab.binding.cardio2e        ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler}={event.topics=openhab/*, service.pid=org.openhab.cardio2e, port=/dev/ttyUSB0, component.name=org.openhab.binding.cardio2e.binding, component.id=192, service.id=322, service.bundleid=209, service.scope=bundle} - org.openhab.binding.cardio2e
12:42:15.615 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - activate
12:42:15.622 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - Serial port set from config file: /dev/ttyUSB0
12:42:15.686 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - Cardio is DISCONNECTED.
12:42:15.688 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - Cardio2e binding activated
12:42:15.698 [INFO ] [b.core.service.AbstractActiveService] - Cardio2e Refresh Service has been started
12:42:15.699 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - execute() method is called!

@JPCoollink
Copy link

I have install openHAB2, put the jar in the addon folder then next?
I don't really understand this openHAB stuff..
eric, as tu réussi?

@ericc514
Copy link

ericc514 commented May 19, 2017

Hi JP,
the first step is to add the 1x compatibility layer in the openhab console. See here:
http://docs.openhab.org/administration/console.html#accessing-the-console

Install the 1.x compatibility layer by running feature:install openhab-runtime-compat1x in the openHAB console

Second step:
when you decompress the zip, you should end up with the following files/folders:

  • cardio2e.cfg
  • demo
  • org.openhab.binding.cardio2e_1.10.0.201704211239.jar

the jar goes into /usr/share/openhab2/addons/ and needs ownership to be changed:

sudo mv /{jar_location}/org.openhab.binding.cardio2e_1.10.0.201704211239.jar /usr/share/openhab2/addons/org.openhab.binding.cardio2e_1.10.0.201704211239.jar 
sudo chown openhab:openhab /usr/share/openhab2/addons/org.openhab.binding.cardio2e_1.10.0.201704211239.jar 

you can disregard the other files.

download the other zip file in this thread: OH2_demo_conf.zip

decompress and (I used) rsync to synchronize the files/folders to /etc/openhab2/

chown the moved files recursively (chown -r …)

stop and restart the openhab service

go back to the openhab console:

set:log DEBUG org.openhab.binding.cardio2e
log:tail

you should now see logs showing up for the binding. If there are no errors related to the binding then you are good to go.

Under the BasicUI, you should now have access to magd’s project.

you will need to use Eclipse Home designer to edit the config files to match your home setup, serial port setup, cardio installer codes, etc..

@ericc514
Copy link

Success part 2:

07:23:34.326 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - Cardio is CONNECTED.
07:23:34.470 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - Cardio2e binding activated
...
07:23:47.883 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Cardio login succeed.

I'm in. Now I need to figure out all my phisical devices.

@magd1978
Copy link
Contributor

magd1978 commented May 20, 2017

Hello, Eric.
This is great! Please consult any questions that arise with the configuration of the items. I hope to have time in the month of June to continue working on the binding. I have several pending issues, such as to finish the asked changes in order to the pull request can be autorized, write javadoc, prepare all documentation for the end user, and implement communications improvements that avoid collisions (sometimes, when communication is dense, the Cardio can ignore some order, because communication is half duplex and Cardio will not listen while it is sending a response).

@JPCoollink
Copy link

Hi,
I was able to run the addon, but it's in spanish.
Also, where can I see the code for all the serial com and command?
Thanks

@magd1978
Copy link
Contributor

magd1978 commented May 21, 2017

Hello, JPCoollink.
You can see the code here: https://github.com/magd1978/openhab1-addons/tree/cardio2e-binding/bundles/binding/org.openhab.binding.cardio2e

The only part that is in Spanish is the openHAB config, because the demo is based on an extract from my openhab config. The descriptions are in Spanish because I have not had time to translate it. Inside this demo you can find some examples from lighting control (switch and dimmer), simple relay control, pair of relays shutter control, HVAC, zones detection, security...
When I have time I intend to write in English a guide that explains all the possibilities of the binding, and how to use them. Sorry for the inconvenience.

Postdata: The class responsible for processing the configuration of the items is https://github.com/magd1978/openhab1-addons/blob/cardio2e-binding/bundles/binding/org.openhab.binding.cardio2e/src/main/java/org/openhab/binding/cardio2e/internal/Cardio2eGenericBindingProvider.java

@ericc514
Copy link

ericc514 commented Jun 7, 2017

Manuel, I've got it working. Playing with the sitemap and figuring out all the 60 dimmers. (yes, 60).
Do you have the reference for the tty commands that get sent to the cardio? I can't seem to find the document.
I'm also trying to turn off all dimmers at the same time.

Thanks for this again!

@magd1978
Copy link
Contributor

magd1978 commented Jun 7, 2017

Hi, ericc514.

I am glad that my contribution has been useful. I would like more time to complete the changes I have pending and to write all the documentation. Sorry for the wait. I'm on it...

Here's a Secant manual with the Cardio RS-232 prococol:
Cardio-Communication-Protocol-Secant-2-Rev-1-0-En-2.pdf

The manual does not contain references to the new COURTAIN objects used in the latest Cardio firmwares. These COURTAIN objects allow blind height management using specific Secant controllers connected to the Cardio RS-485 bus (like the dimmers). I could determine that its syntax is analogous to LIGHTING objects using a sniffer on the RS-232 port.

On the other hand ... wow! 60 dimmers!
If you want to turn them on or off all at once, I would recommend using Cardio scenes and calling them from openHAB.

But if you want to do it with openHAB, you can add all the dimmers to an active group like the "Luces" group of the demo that I uploaded, and send commands to that group. The problem is that the Cardio RS-232 communication is slow (9600 bps.), half duplex, and also has no flow control. For each LIGTHING transaction sent, the Cardio responds with an ACK message and an INFO message (or a NACK if it could not execute the command). And for the duration of the response it does not accept new orders. That is why there is a buffer of transactions to be sent and a minimum delay between each transaction received and a new sending, and a minimum delay between two sendings. All this is designed to await the Cardio's answers before giving it new orders. Still, if you send many orders in a row, you run the risk of colliding with an ACK or INFO response, so the Cardio could ignore some of the orders sent. So I've been thinking about implementing an improvement that checks receiving data at every step of the sending process. These checks would allow postponing (and even repeating) sending if any information is received during execution of this part of the code.

Anyway, if you are going to handle so many dimmers, these settings may help you in the binding configuration:

To avoid sending values ​​to the dimmers if they match the current values ​​(for example, if dimmer #27 is at 86% and a command is received from the openHAB bus that asks to put this same dimmer at 86%, it will not be sent any transaction to the Cardio, because the dimmer already has that value).
Cardio2e:filterUnnecessaryCommand = true

To avoid adding to the sending buffer contradictory LIGHTING transactions to those that are pending to be sent (for example, if there is a pending transaction to send to the dimmer #42 with the value 50% and a command is received from the openHAB bus requesting to put to this same dimmer to 100%, the existing transaction with 50% value will be eliminated and the new one with 100% value will be added).
Cardio2e:smartSendingEnabledObjectTypes = LIGHTING

@ericc514
Copy link

ericc514 commented Jun 7, 2017

Hi Manuel,
Thanks for the pdf.

I just remembered that functions like "All lights off" can be programmed directly into the Cardio with scenes (scenarios?), so I'll look into configuring that instead. That way I send only one command and let the box figure it out.

@ericc514
Copy link

ericc514 commented Jun 8, 2017

Hi Manuel,

23:20:12.746 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'Scenario' received command 2
23:20:12.746 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - Added '@S M 3' to Cardio 2é RS-232 send queue

according to the communication protocol this should send '@s M 2', no?

If I'm understanding this correctly, your base scenario state is starting at 0 instead of 1. (there is no state 0 for scenarios on the cardio)

Could this be because it's defined as a switch under OH1?

Let me know if I'm not clear, it's late here in Montreal. ;-)

@ericc514
Copy link

ericc514 commented Jun 8, 2017

Also,
No state sent to Cardio 2è because item is not configured as 'reverse mode'

I am assuming this is because my openhab entries don't match the cardio's hard-coded entries. correct?

no worries, it works, it just fills up the logs.

@magd1978
Copy link
Contributor

magd1978 commented Jun 8, 2017

Hi Eric.

In Spain we have 6 hours of difference. Now it's 1:00 p.m. here.

It is right. To call Cardio scenarios 1 to 42 you must use values ​​0 to 41. This is to maintain compatibility with the values ​​used on the KNX bus (DPT18.001), where values ​​0 to 63 are used to call scenes 1 to 64.

You see ... When I started working on Cardio IIé binding, my initial goal was to be able to extend the installation with KNX. That is why I have tried to make the values ​​used compatible.

As for the message "No state sent to Cardio 2è because item is not configured as 'reverse mode'", you can ignore it. It only appears in debug mode.

The Cardio binding can be configured so that certain objects of the Cardio operate in inverse mode (using Cardio as a control instead of actuator). Example: you can control the power on of your openHAB TV by defining an item connected to the appropriate binding, and also add an unused RELAY object from the Cardio in reverse mode (you must write "!RELAY", with the "!" symbol in front, instead). So that when the Cardio binding receives an INFO transaction, a command is sent to the openHAB bus, and when a status is received from the openHAB bus, it is sent to the Cardio as a command.

So, the message "No state sent to Cardio 2è because item is not configured as 'reverse mode'" simply tells you that the status of the item will not be forwarded to the Cardio because the configuration of the object has not been defined as reverse mode. In this case it must be the same state sent to the openHAB bus by the Cardio binding which arrives back from the bus and is ignored.

@ericc514
Copy link

ericc514 commented Jun 8, 2017

Got it. Thanks Manuel.

@9037568 9037568 added the stale label Jul 14, 2017
@magd1978
Copy link
Contributor

magd1978 commented Aug 3, 2017

Hello.

Here you are a new JAR compilation of the binding. New anti-collision and verification improvements in communications are implemented.
org.openhab.binding.cardio2e_1.10.0.201708022030.jar.zip

They are still pending some changes requested by the openhab community.

I hope you will be useful while I finish the final version.

@magd1978
Copy link
Contributor

magd1978 commented Sep 7, 2017

Working on a Cardio2e binding config guide.
Still pending some changes requested by the openhab community.
Thank you very much for your patience.

@JPCoollink
Copy link

Hi,
I was able to install everything on a CHIP board @10$.
But i don't know why, the cardio don'T stay connected.
Not long after cardio bundle is load i get "Cardio2e Refresh Service has been shut down"
Any idea? I also tried the testMode to see if i could at least test my things but it does the same.
see log:

2017-10-03 04:04:46.434 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Serial port set from config file: /dev/ttyS0
2017-10-03 04:04:46.444 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Program code updated from config file
2017-10-03 04:04:46.451 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Security code updated from config file
2017-10-03 04:04:46.454 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Zone state detection disabled in config file
2017-10-03 04:04:46.459 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Zone state unchanged minimum refresh delay updated to 600000 milliseconds from config file
2017-10-03 04:04:46.463 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Date and time maximum offset updated to 15 minutes from config file
2017-10-03 04:04:46.467 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - In the configuration file was disabled that the first update always sets the date and time
2017-10-03 04:04:46.472 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Allowed date and time update hour limit disabled in config file
2017-10-03 04:04:46.476 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Test mode enabled in config file
2017-10-03 04:04:46.480 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Minimum delay between receiving and sending updated to 200 ms. from config file
2017-10-03 04:04:46.483 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Minimum delay between sendings updated to 300 ms. from config file
2017-10-03 04:04:46.486 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Filter unnecessary command disabled in config file
2017-10-03 04:04:46.489 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Filter unnecessary reverse mode update enabled in config file
2017-10-03 04:04:46.494 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Smart sending enabled for LIGHTING object type in config file
2017-10-03 04:04:46.498 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Smart sending enabled for RELAY object type in config file
2017-10-03 04:04:46.503 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Smart sending enabled for HVAC_CONTROL object type in config file
2017-10-03 04:04:46.506 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Smart sending enabled for DATE_AND_TIME object type in config file
2017-10-03 04:04:46.508 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Smart sending enabled for SCENARIO object type in config file
2017-10-03 04:04:46.511 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Smart sending enabled for SECURITY object type in config file
2017-10-03 04:04:46.512 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Smart sending enabled for ZONES_BYPASS object type in config file
2017-10-03 04:04:46.514 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Smart sending enabled for CURTAIN object type in config file
2017-10-03 04:04:46.523 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Cardio is CONNECTED.
2017-10-03 04:04:46.533 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - Sent '@s P I 99999' to Cardio 2?
2017-10-03 04:04:46.537 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - Cardio2e binding activated
2017-10-03 04:04:46.544 [DEBUG] [org.openhab.binding.cardio2e ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler}={securitycode=11224, filterUnnecessaryCommand=false, smartSendingEnabledObjectTypes=LIGHTING,RELAY,HVAC_CONTROL,DATE_AND_TIME,SCENARIO,SECURITY,ZONES_BYPASS,CURTAIN, component.id=182, programcode=99999, zoneUnchangedMinRefreshDelay=600000, component.name=org.openhab.binding.cardio2e.binding, allowedDatetimeUpdateHour=-1, port=/dev/ttyS0, datetimeMaxOffset=15, filterUnnecessaryReverseModeUpdate=true, zones=false, testmode=true, service.pid=org.openhab.cardio2e, firstUpdateWillSetDatetime=false, minDelayBetweenSendings=300, event.topics=openhab/*, minDelayBetweenReceivingAndSending=200, service.id=312, service.bundleid=9, service.scope=bundle} - org.openhab.binding.cardio2e
2017-10-03 04:04:46.545 [INFO ] [b.core.service.AbstractActiveService] - Cardio2e Refresh Service has been started
2017-10-03 04:04:46.551 [DEBUG] [ng.cardio2e.internal.Cardio2eBinding] - execute() method is called!
2017-10-03 04:04:46.763 [DEBUG] [org.openhab.binding.cardio2e ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.cardio2e.Cardio2eBindingProvider}={component.name=org.openhab.binding.cardio2e.genericbindingprovider, component.id=183, service.id=311, service.bundleid=9, service.scope=bundle} - org.openhab.binding.cardio2e
2017-10-03 04:04:46.775 [DEBUG] [org.openhab.binding.cardio2e ] - BundleEvent STARTED - org.openhab.binding.cardio2e
2017-10-03 04:04:53.498 [INFO ] [b.core.service.AbstractActiveService] - Cardio2e Refresh Service has been shut down

@magd1978
Copy link
Contributor

magd1978 commented Oct 3, 2017

Hello JPCoollink.

As I see it, the binding open the serial port ("Cardio is CONNECTED") but it does not get to do login (there is no "Cardio login succeed" in the log). Please, check wiring and installer program code.

I have tested the binding with openHAB1 running on a RaspBerry 1B, and with openHAB1 and openHAB2 running on a PC (Windows and Linux). The RS-232 interface used in testing is a USB adapter with Prolific PL-2303 chip. Can you give me some more information about the hardware you use?

Please do not activate the "testmode" option. This option is for internal developer use only. The binding will never communicate with the Cardio with this option enabled.

I am writing a binding configuration document, which is not yet finished. I will attach a fragment as an advance to help you with the configuration:
Cardio2e Binding config v0.1.pdf

@JPCoollink
Copy link

It is working now, i was able to add slider to control my lights.
This is nice.
Now i am trying to use the homekit integration service.
I am not sure how to configure the items file for homekit.
I was able to create a homekit device by adding:

Dimmer BedroomLights "Bedroom Lights" (gBedroom) [ "Lighting" ]
as the top of my items file, but how do i link that to a dimmer for cardio?
Let says this:
Dimmer Light_P0_SS_TV "TV [%d %%]" (P0_SS, Light) {c2e="LIGHTING,%17"}

thank you

@magd1978
Copy link
Contributor

magd1978 commented Oct 4, 2017

Hi, JPCoollink.

I am glad that you have finally been able to solve the problem of communication with the Cardio.

I'm sorry, but I can not help you with the HomeKit setup. I have not had a chance to try it. But there should be no differences with examples with other binding integrations.
From what I could see in this video https://www.youtube.com/watch?v=zUudW7ajQQ8 the item could look something like this:
Dimmer Light_P0_SS_TV "TV [%d %%]" (P0_SS, Light) [ "Lighting" ] {c2e="LIGHTING,%17", autoupdate=false}

As I told you yesterday, I am writing a binding configuration document, which is not yet finished. I will attach another fragment as an advance to help you with the configuration of the item:
Cardio2e Binding items v0.1.pdf

@9037568 9037568 removed the stale label Nov 15, 2017
@9037568
Copy link
Contributor

9037568 commented Nov 15, 2017

Closed via merged PR.

@9037568 9037568 closed this as completed Nov 15, 2017
@fapgomes
Copy link

fapgomes commented Sep 6, 2018

Hi,

I've this binding working very well in a centos7 box, but I'm try'ing to get it to work on a raspberrypi. In the raspberry I've this error:

2018-09-06 22:06:43.561 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Serial port set from config file: /dev/ttyAMA0
2018-09-06 22:06:43.567 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Security code updated from config file
2018-09-06 22:06:43.572 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Zone state detection enabled in config file
2018-09-06 22:06:43.579 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Allowed date and time update hour set to '8' in config file
2018-09-06 22:06:43.794 [INFO ] [ng.cardio2e.internal.Cardio2eBinding] - Cardio is CONNECTED.
2018-09-06 22:06:44.001 [INFO ] [b.core.service.AbstractActiveService] - Cardio2e Refresh Service has been started
2018-09-06 22:06:45.243 [WARN ] [ng.cardio2e.internal.Cardio2eBinding] - Can not send state to Cardio 2è because we are not logged in

Can you help?

Best Regards,
Fernando Gomes

@magd1978
Copy link
Contributor

magd1978 commented Sep 7, 2018

Hi, Fernando.

I am pleased to inform you that the binding has already been approved, and if everything goes well, it will be officially available in openHAB 2.4. You can check the configuration guide in https://www.openhab.org/addons/bindings/cardio2e1.

If 'Cardio login suceed' does not appear in the log, it is that no login confirmation has been received from Cardio. This can occur because of a configuration error, or because of problems with the serial port or wiring.

My tests with this binding were done on a Raspberry Pi 1B and also on a Raspberry Pi 3B. And in both cases I connected by a Prolific PL-2303 based USB to RS-232 converter interface.
In the log I see that you have configured as serial port '/dev/ttyAMA0' that gets to open correctly ('Cardio is CONNECTED'). I have never used this internal Raspberry port to connect to Cardio, and I do not know if it would work. In order to use that port you must disable Linux's use of console UART (see https://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/). And if you have a Raspberry 3, that port is used by the bluetooh module, which could be causing a conflict. In this case, you must also disable bluetooh (see https://raspberrypi.stackexchange.com/questions/53149/disable-power-on-wifi-and-bluetooth-interfaces-during-boot). Both settings can easily be made by openhabian configurator (sudo openhabian-config -> 30 | System Settings -> 35 | Serial port).

On the other hand I do not see that you have set the 'programcode', so the binding will use the default code that is '00000'. If your Cardio has set a different code, you have to specify it in the binding config file.

If with these indications you do not manage to make it work, it would be good to adjust the binding log to the 'DEBUG' level, and thus obtain more information of what is being able to fail. To do this, enter 'log: set DEBUG org.openhab.binding.cardio2e' in the Karaf console (see https://www.openhab.org/docs/administration/logging.html#defining-what-to-log).

Best Regards,
Alberto Guerrero

@fapgomes
Copy link

fapgomes commented Sep 8, 2018

Hi,

Thanks a lot for you anwser. I had configured with "dtoverlay=pi3-miniuart-bt", but I managed get it work with:

enable_uart=1
core_freq=250

I need the core_freq=250, otherwise I had problems in the communication.

Best Regards,
Fernando Gomes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants