필터 지우기
필터 지우기

MQTT and Shelly EM

조회 수: 18 (최근 30일)
Mauro Emme
Mauro Emme 2022년 3월 24일
편집: abba baab 2023년 2월 10일
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
Christopher Stapels
Christopher Stapels 2022년 3월 28일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

abba baab
abba baab 2023년 2월 10일
편집: abba baab 2023년 2월 10일
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
abba baab
abba baab 2023년 2월 10일
편집: abba baab 2023년 2월 10일
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.

댓글을 달려면 로그인하십시오.

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

Help CenterFile Exchange에서 Write Data to Channel에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by