20_X10 add SetExtensions

Begonnen von mgmino, 17 Dezember 2023, 15:34:37

Vorheriges Thema - Nächstes Thema

mgmino

The current 20_X10 module implements a few of the SetExtensions command set. Is there a plan to incorporate the SetExtensions.pm module?

Dr. Boris Neubert

Hi,

I am surprised to read that someone still uses the X10 system. I have decommissioned the equipment many years ago.

Please give it a try and incorporate the SetExtension! Since you can test it and can confirm it working, I would be happy to include the result in the official repository.

I now follow this thread.

Kind regards
Boris
Globaler Moderator, Developer, aktives Mitglied des FHEM e.V. (Marketing, Verwaltung)
Bitte keine unaufgeforderten privaten Nachrichten!

mgmino

Thank you for the quick reply. I like the local (non cloud dependency) control of X10 and had a few modules laying around.

I will attempt to incorporate the SetExtensions module -- first I will add some documentation to confirm my understanding. If I get stuck, I will send you what I have.

mgmino

Boris - I have modified the 20_X10.pm module and attached it. Let me know if you see an issues. I have tested it with my hardware. A few questions:
  • why is there a reference to FS20 which I included from the original code; I think line 311 should be deleted
  • what is the difference between return; and return undef; I used the later since it was used elsewhere in X10_Set
Du darfst diesen Dateianhang nicht ansehen.

Dr. Boris Neubert

Thank you for the enhancements.

I changed the reference from FS20 to X10 - this was a copy&paste error that has gone unnoticed for almost an eternity.

In scalar context return and return undef are the same. More on that topic here: https://stackoverflow.com/questions/3435122/whats-the-difference-between-return-and-return-undef-in-perl. Conclusion: one should use return undef.

I checked the new version into the subversion repository. You should be able to retrieve it by update tomorrow after 08:00 UTC+1.
Globaler Moderator, Developer, aktives Mitglied des FHEM e.V. (Marketing, Verwaltung)
Bitte keine unaufgeforderten privaten Nachrichten!

mgmino

Thank you for the update.

Is the delete $modules{X10}{ldata}{$a[0]}; needed since it is overwritten in the next statement $modules{X10}{ldata}{$a[0]} = $hms_spec; ? I thought there was some backend relationship with FS20.

This has been a great experience on how to write a module. I will add the toggle feature for the next iteration and do some further code cleanup as my understanding improves.

One mystery is how does the function set (%functions_set) get communicated to fhem so it can populate the set drop down list?

Beta-User

Zitat von: mgmino am 20 Dezember 2023, 15:43:02One mystery is how does the function set (%functions_set) get communicated to fhem so it can populate the set drop down list?
This is done by the "getAllSets()" function, see (unfortunately german) short explanation in https://wiki.fhem.de/wiki/DevelopmentModuleIntro#X_Set. That parses the returned text to extract the setters list.

There's also some further info found about SetExtensions in there, so you will find there you don't need to implement an own "toggle" function.
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn: u.a MySensors, Weekday-&RandomTimer, Twilight,  div. attrTemplate-files