Closed utdrmac closed 5 months ago
I changed it to this:
self.client.publish(self.base_topic, json_object, 0, properties=self.mqtt_properties)
and now it seems to work.
I also noticed that self.mqtt_properties is not sent along when using non-json output.
hmm. to be honest, some residual code from the original project. :P since the mqtt server \w home assistant didn't work with the json output.
i'll update the repo for the next release.
would you say mqtt message expiry is important? / should be made configurable? that's all that the properties is setting from what i can see.
I don't think that is important, no. For the record, I'm going MQTT->Telegraf->InfluxDB and telegraf isn't handling all the individual topics well. Telegraf has native json payload decoding, so I'm trying that next. If that doesn't work, then I'm just going to modify the code to write directly to influx, bypassing mqtt altogether.
interesting...
did some googling. influxdb Line Protocol
could definately be implemented as a "transport" in the project.
This is troublesome:
"time_year": 24,
"time_month": 5,
"time_date": 3,
"time_hour": 11,
"time_minute": 17,
"time_second": 59,
I realize this is how the inverter stores it internally. Where would be the best place in the code to put these together as a timestamp? And it might be unique to EG4 inverters, so the code shouldn't be "global"
not entirely unique to EG4.
hmmm... in HA i'd just use a script to combine them...
i think it would be a bit tricky to implement. need to think on this one.
for the half completed pylon 485 protocol, i have to add a scripting / math language... it could maybe be added when i do that.
writing to the values wouldn't be easily implemented though. so would be a read-only thing.
ok, i added to the .gitignore, so it would be safe for you to just make a "custom" transport as a "short-term" solution.
copy this into say, mqtt.custom.py
then you could put code to combine the values here: https://github.com/HotNoob/PythonProtocolGateway/blob/0e69f3c21a302dc4812d3639b1f874b8c315e839/classes/transports/mqtt.py#L156
when configuring:
transport=mqtt.custom
Just tried setting
json = true
for mqtt