joesie / gpio Goto Github PK
View Code? Open in Web Editor NEWThis is a loxberry-plugin to handle GPIO over MQTT
Home Page: https://www.loxwiki.eu/display/LOXBERRY/GPIO
License: Apache License 2.0
This is a loxberry-plugin to handle GPIO over MQTT
Home Page: https://www.loxwiki.eu/display/LOXBERRY/GPIO
License: Apache License 2.0
Wenn du LoxBerry::System includest, hast du immer die Pfade zu deinem Plugin als Variablen verfügbar.
Z.B. $lbphtmlauthdir
zeigt immer in dein htmlauth, oder $lbpbindir
zu deinen bin's.
Alle Variablen, die's gibt, stehen hier: https://www.loxwiki.eu/display/LOXBERRY/Perl-Modul+LoxBerry%3A%3ASystem
Grundsätzlich solltest du nie absolute Pfade, sondern Variablen verwenden. Michael's System bei der Plugininstallation kann den Pfad eines Plugins ändern, wenn ein Ordner nicht unique ist. Mit den Variablen ist sichergestellt, dass du immer in "deinen" Verzeichnissen operierst.
EDIT/PS: Das sind halt so Feinheiten, aber ist erstmal nicht so gravierend, aber langfristig besser :-)
With using MQTT it is not longer necessary to configure miniserver in plugin.
When user update the plugin from a fewer version like 2.0.7, the new version doesn't work. If they reinstall the older version, the older version works again.
It looks like, that the new version can't work with the old plugin configuration.
Die Ports können mit dem Raspberry 4 B+ nicht mehr geschaltet werden. Ich vermute es liegt am verwendeten pigpiod.service. Da ich ihn auch über die Konsole nicht setzen kann.
loxberry@lob-dg1:~ $ pigs modes 17 w
loxberry@lob-dg1:~ $ pigs w 17 1
loxberry@lob-dg1:~ $ pigs r 17
0
loxberry@lob-dg1:~ $ pigs w 17 1
loxberry@lob-dg1:~ $ pigs r 17
0
loxberry@lob-dg1:~ $ pigs w 17 0
loxberry@lob-dg1:~ $ pigs r 17
0
loxberry@lob-dg1:~ $ sudo systemctl status pigpiod
● pigpiod.service - Daemon required to control GPIO pins via pigpio
Loaded: loaded (/lib/systemd/system/pigpiod.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2020-05-10 20:17:02 CEST; 1 weeks 3 days ago
Main PID: 177 (pigpiod)
Tasks: 4 (limit: 4035)
Memory: 964.0K
CGroup: /system.slice/pigpiod.service
└─177 /usr/bin/pigpiod -l -n 127.0.0.1
May 21 10:47:53 lob-dg1 pigpiod[175]: 2020-05-21 10:47:53 pthSocketThreadHandler: Socket 6 closed
May 21 10:47:56 lob-dg1 pigpiod[175]: 2020-05-21 10:47:56 pthSocketThread: Connection accepted on socket 5
May 21 10:47:56 lob-dg1 pigpiod[175]: 2020-05-21 10:47:56 pthSocketThread: SO_KEEPALIVE enabled on socket 5
May 21 10:47:56 lob-dg1 pigpiod[175]: 2020-05-21 10:47:56 pthSocketThreadHandler: Socket 5 closed
May 21 10:48:00 lob-dg1 pigpiod[175]: 2020-05-21 10:48:00 pthSocketThread: Connection accepted on socket 6
May 21 10:48:00 lob-dg1 pigpiod[175]: 2020-05-21 10:48:00 pthSocketThread: SO_KEEPALIVE enabled on socket 6
May 21 10:48:00 lob-dg1 pigpiod[175]: 2020-05-21 10:48:00 pthSocketThreadHandler: Socket 6 closed
May 21 10:48:02 lob-dg1 pigpiod[175]: 2020-05-21 10:48:02 pthSocketThread: Connection accepted on socket 5
May 21 10:48:02 lob-dg1 pigpiod[175]: 2020-05-21 10:48:02 pthSocketThread: SO_KEEPALIVE enabled on socket 5
May 21 10:48:02 lob-dg1 pigpiod[175]: 2020-05-21 10:48:02 pthSocketThreadHandler: Socket 5 close
The pins can be switch by using GPIO number. But its also good to have user friendly and configurable names to use PINs
The UI perl script checked, if a mqtt plugin is installed and already configured.
The corefunction I use has a bug . When the mqtt plugin isn't installed it comes to an error and no webseide will be publish.
Error:
Can't use string ("") as a HASH ref while "strict refs" in use at /opt/loxberry/libs/perllib/LoxBerry/IO.pm line 499.
Depending of what you have done, report this error to the plugin developer or the LoxBerry-Core team.
Further information you may find in the error logs.
https://github.com/joesie/io/blob/3974af74366815ffe0dd2fe18599d3353c8e5ff3/plugin.cfg#L73
Ein GPIO-Plugin kann nur auf einem Raspberry laufen.
ARCHITECTURE="raspberry"
Make a default value for duty cycle configurable in the UI.
For example:
1. Bei einem allgemeinen Topic des Plugin Json-Dataset akzeptieren:
publish loxberry/gpio/set/json { "0": "on", "3": "off", "4":"off"}
Das wäre primitiv zu parsen und zu loopen.
Bitte name
und title
lowercase schreiben (steht auch so ein paar Zeilen darüber)
Das kann sonst Probleme mit der Pluginerkennung von LoxBerry::System geben.
https://github.com/joesie/io/blob/3974af74366815ffe0dd2fe18599d3353c8e5ff3/plugin.cfg#L26
When a broker port is set it comes to an exception.
Line 20 in b8cccf3
Das muss mit einem & hinten aufgerufen werden, damit es als Daemon ausgeführt wird.
Wenn nicht, bleibt der Daemon dort stehen, und andere Daemons kommen nicht dran.
lg, Christian
( Siehe z.B. https://github.com/christianTF/LoxBerry-Plugin-MQTT-Gateway/blob/62e868e2031e318656cb91645fc1978d065524c3/daemon/daemon#L28)
After update/upgrade the daemon doesn't restart at the moment.
From istallation log:
INFO: Start MQTT GPIO client
bash: /opt/loxberry/bin/plugins//wrapper.sh: No such file or directory
It would be nice to have PWM outputs
In some cases, a main error can come up. This error would be shown in a MQTT message.
But at the moment this error state doesn't remove anymore.
At the moment to switch a output, you have to send the GPIO number instead of the configured output-channel
It is not sure, that the MQTT Gateway is up and ready before this plugin starts.
So in some situation it is possible that the plugin sends messages, before the gateway is up.
Add option to use an external MQTT Broker (e. g. MQTT Gateway Plugin running on another LoxBerry).
show user, if mqtt is running on loxberry
Currently it's possible to configure GPIO27 as output(input.
But it isn't possible yet to switch it. The loop in line 259 isn't correct.
Hallo, bei mir ist folgender Fehler aufgetreten:
Ich übertrage 1-Wire Temperatursensoren über den Mosquitto Broker. Als ich danach dein GPIO plugin installiert habe, konnte sich der Broker nicht mehr anmelden. Möglicherweise besteht hier ein Port Problem.
lg Michael
At the moment the plugin try to connect the broker one time. If the broker is still not running a exception comes.
A better way is, to reconnect if a exception throws.
After start up loxberry it's nice to send status from configured IOs
The MQTT doesn't use the loglevel. At the moment you can change it, but the logging is always in debug mode
It would be nice to read higher frequencies from GPIO input.
For that case it's necessary to implement a special handling.
The cron job script ends with an error when the plugin isn't running.
Message:
gpio: line 38: syntax error: unexpected end of file
Hat ein wenig gedauert - ich war die Woche im Ausland, und heute musste ich auch noch Miniserver-SD-Karte tauschen (kaputt), und trotzdem auch das Wetter ausnutzen :-)
Ich hab leider keine Relais am Pi, deswegen habe ich keinen Live-Test mit Relais machen können.
Ein paar Sachen habe ich dir eh als Issues erstellt.
Beim Einrichten hab ich nicht recht gewusst, was ich in die Felder hineinschreiben soll. Oben war mir klar, aber unten? Ich habe dann im Code nachgeschaut, und das ist somit einfach die GPIO-Nummer. Wäre es nicht logischer, wenn ich als Parameter gleich die GPIO-Nummer mitgebe, statt die Nummer vom Plugin?
Das Senden funktioniert, cool wäre noch, wenn auch bei OK ein Text als Result käme.
Ob das, was ich sende, ankommt, weiß ich nicht genau, wie ich das prüfen kann.
Beim Speichern der Ausgangsnummern bekomme ich einen Fehler 500, aber gespeichert wird trotzdem. Ich habe 0, 1, 2 probiert
Dann hab ich noch gesehen, dass mir das Plugin bei jedem Reboot eine Notification sendet (Siiehe Screenshot). Das kommt definitiv von dir, weil ich habe gar kein Sonos ;-)
Das GUI und die falschen Eingaben der Benutzer sind das Schwierigste! :-)
lg, Christian
It's nice for users to can copy the commands and input names in Loxone config.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.