Effacer les filtres
Effacer les filtres

MQTT and Shelly EM

18 vues (au cours des 30 derniers jours)
Mauro Emme
Mauro Emme le 24 Mar 2022
Modifié(e) : abba baab le 10 Fév 2023
Hi, I've used the service since 2018 and I'm very happy with it. In these days I've added some sensors (Shelly) to my project and I'm trying to switch to MQTT since they suppport it:
I've configured all for ThingS. side and tried to send data via MQTT with a manual client to see if it runs. Done. It runs.
The problem is that Shelly sensors use their specifi topics:
  • shellies/shellyem-<deviceid>/emeter/<i>/energy energy counter in Watt-minute
  • shellies/shellyem-<deviceid>/emeter/<i>/returned_energy energy returned to the grid in Watt-minute
  • shellies/shellyem-<deviceid>/emeter/<i>/total total energy in Wh (accumulated in device's non-volatile memory)
  • shellies/shellyem-<deviceid>/emeter/<i>/power instantaneous active power in Watts
  • shellies/shellyem-<deviceid>/emeter/<i>/reactive_power instantaneous reactive power in Watts
  • shellies/shellyem-<deviceid>/emeter/<i>/voltage grid voltage in Volts
  • shellies/shellyem-<deviceid>/emeter/<i>/pf power factor (dimensionless)
  • shellies/shellyem-<deviceid>/relay/0 reports status: on, off or overpower
and, as I can see, they could not been changed.
On the other side, ThingS has his own topic stucture:
channels/619092/publish/fields/field1
Is there a way by ThingsSpeak side to "translate" or "bridge" or something else 1 topic to another one? Any idea would be appreciated.
  1 commentaire
Christopher Stapels
Christopher Stapels le 28 Mar 2022
You can definitely use another device such as an Arduino or ESP32 as a bridge, though that may be a bit heavy to get temperature and humidity data. I looked at the Shelly documentation a bit and I could not see how to use a custom topic. I suspect it is settable somewhere though if you have access to the firmware (maybe you have to work for Shelly for that). If they have a forum or you can reach out to their support, Id like to know.

Connectez-vous pour commenter.

Réponses (1)

abba baab
abba baab le 10 Fév 2023
Modifié(e) : abba baab le 10 Fév 2023
I have Shelly 1PM which is "first gen device" aka without scripting. I use ESP32 with Python script to send values to Thingspeak:
# Shelly 1PM
r = requests.get('http://SHELLYIP/status', auth=('USER', 'PASSWORD'), timeout=2.50)
r2 = r.json()
# Remove decimals and assign to variable
watts = int(r2['meters'][0]['power'])
print(watts)
field1 = watts
# Thingspeak request
url = 'https://api.thingspeak.com/update.json'
myobj = {
'api_key': 'YOURAPIKEY',
'field1': field1
}
x = requests.post(url, json = myobj, timeout=2.50)
  1 commentaire
abba baab
abba baab le 10 Fév 2023
Modifié(e) : abba baab le 10 Fév 2023
Second generation Shelly devices aka "plus" devices support scripting. So those can send the values to Thingspeak by themself. I'm about to do such script soon.

Connectez-vous pour commenter.

Communautés

Plus de réponses dans  ThingSpeak Community

Catégories

En savoir plus sur Write Data to Channel dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by