I have just installed my 3em. It is my first Shelly product. I did update the firmware. I am using mqtt and not the cloud. I am using a custom python program to process the mqtt messages into a mysql database and I view the collection with Grafana.
((about my install -- My 3em is installed on the split single phase 240V 3-wire service (third CT on the neutral) the electrical coop provides. I do not have solar nor batteries. My coop does not yet do time of use metering. They do measure peak load and we pay a charge for the highest demand between the hours of 16:00 and 20:00 that is recorded during the month. I am using the 3em to shed load during that time period during the day.))
I am trying to consolidate the 18 separate mqtt topics and their payloads into a single row in a mysql database.
I am temporarily ignoring topics that contain "energy" as well as the relay until I find a use for them.
These 18 messages represent the value states at a particular point in time (and I want my database row to reflect the states at that point in time). If the mqtt data reporting could be improved, I would like to have these 18 datapoints in a single json payload.
I am currently accepting each topic and holding the payload until I have received all 18 and then I issue a database insert. A second appearance of a particular topic before all 18 have been gathered also triggers the database insert and the start of collection for a new row.
Every so often, the 3em sends only six topics, those for total and total_returned (for each of the three CT). These same topics are also sent in the group of 18. This causes a problem for my program logic that expects all 18. Are these necessary? What is their purpose?
I am unable to find any controls over the frequency of mqtt topic publishing. Is this event driven? Is it possible to make the 3em report more frequently?
I am using the custom mqtt prefix to shorten the topic. The topic up to the /CT number is still quite long. I realize that the topic was probably chosen with all Shelly devices in mind, but I would appreciate a means of shortening it considerably. You can ignore this thought if you find the single json payload acceptable.
Thank you for your time and consideration.