-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run pyess as daemon/service under Linux, comments #3
Comments
Hi,
from then on you should be able to call 2.) The request here is that essmqtt somehow registers as an mqtt client -- could you point me towards specification on how this is usually done? 3.) The typos are actually what is sent by the LG box -- I agree they are typos but I wouldn't want to rename these to fix a typo made by LG. 4.) I don't know exactly what the status means, I assume that they somehow relate to the direction of the power flows. You may get clues by running the app in parallel, especially when the direction of power flows changes (for instance monitor it while switching on a load that changes your power balance such that you go from feeding the grid to not feeding it any more, or compare it in the evening before and after the last watts have stopped coming in during sunset). |
Thanks for the quick reply. I will try 1) as described by you. On 2) I have no clue about the protocol's details. What I see in iobroker's MQTT server adapter is: "List of connected clients: mosqsub|89309-iobroker-" when I run mosquitto_sub in parallel to essmqtt. If you give me a starting point, I'm more than happy to figure the details out, despite my limitiations when it comes to reverse engineering. 3) I fully agree. 4) Okay, I'll try to figure that out and keep you posted... |
In Ubuntu 18.04 Server I got essmqtt to run as service like:
Problem: the service does not run after startup/ reboot, it needs to be started with: Having enabled the service (
Manual start as descibed above works. Can it have something to do with permissions/ rights? I also tried a waiting time in the service but no success. |
Hi @fu-zhou this looks promising, earlier on your logs showed that the module wasn't even found. The error now seems to be that the service cannot connect. Is the current log from a start at boot? I'm asking because I had the same problem once with a systemd service that was starting before network was started. But if you're manually starting it via I'll get back to you later after trying to replicate this on a debian machine. |
I know what it is: The MQTT Server Adpater of iobroker needs to run first and that takes a while... According to "htop" the process/ Command which needs to run is "io.mqtt.0" The a.m. service won't run on your system either as - I guess - you won't have an MQTT Server running on that machine... Putting
Is certainly the first step, but we also have to tell the service to wait until io.mqtt.0 is running:
|
@fu-zhou great to see that you solved it. Actually I ran it against my mqtt server so it was working with systemd on my machine. I'll see that I add an optional reconnect loop. Also makes sense in case the mqtt server has to be restarted, we don't want to crash in that case, either. |
Actually I didn't get it resolved yet... I still miss the piece to have the essmqtt.service wait for io.mqtt.0 to be started under iobroker.service. Reconnect loop sounds good! |
@fu-zhou the easiest will be to just make systemd restart your service when it fails, something along these lines:
|
I split off the "register as an mqtt client" point from the original issue into a separate issue - it is currently hard to implement because the mqtt library used for pyess does not support a "last will and testament" and as far as I could find out that is required to provide this functionality. edit: I also split off the "what do statuses mean" question. |
Awesome, the service works now after boot-up with
|
Okay, I will close this issue then. Thank you @fu-zhou for your comments and cooperation in fixing this, I will add your systemd service configuration example to the documentation later on. I will think about adding an internal auto-reconnect but for the time being i think it is fine to have it handled by systemd, maybe even better than "hiding" it behind an internal retry. |
I got my system up and running now, essmqtt is awesome, thanks for all the effort put in so far!
I have a couple of requests/ comments meanwhile:
2.)
The MQTT Broker updates all the values according to the set interval_seconds, but doesn't show that it is connected to the essmqtt client. As soon as I start mosquitto_sub, the MQTT Broker recognizes mosquitto_sub and shows it as client and mosquito_sub receives all the data from essmqttsplit into Register last will and testament for essmqtt #43.) Minor: typos in
mqtt.0.ess.common.PCS.pcs_stauts is supposed to be pcs_status, I guess
mqtt.0.ess.common.LOAD.today_batt_discharge_enery = energy
4.)
Is there a clue what the satusses mean? E.g. pcs_status 3, what does the 3 stand for? That also applies to e.g. mqtt.0.ess.common.BATT.statussplit into Improve documentation on statuses #5Thanks again for all the effort put in here!
The text was updated successfully, but these errors were encountered: