ShellyTeacher for Domoticz

For devices supporting the Auto Discovery feature. Like ZWaveJS2MQTT, Zigbee2MQTT.

Moderator: leecollings

lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: ShellyTeacher for Domoticz

Post by lwolf »

Quax1507 wrote: Sunday 21 January 2024 13:11 The problem is, that only Lux and Temp are updated when a motion or tamper is triggered.
Shelly Motion has a "cooldown time" its default as 5 minute as i remember, and it wont send you motion again until its reached. Although tamper has to arrive instantly. You can try to remove the motion and tamper device from Domoticz and re-run the teacher to create them again.
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by Quax1507 »

Shelly Motion has a "cooldown time" its default as 5 minute as i remember, and it wont send you motion again until its reached. Although tamper has to arrive instantly. You can try to remove the motion and tamper device from Domoticz and re-run the teacher to create them again.
That's right. I have set this timer to one minute for testing.
When I trigger a motion, the sensor sends out data via MQTT, but oviously motion or tamper does not arrive in Domoticz
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: ShellyTeacher for Domoticz

Post by lwolf »

Quax1507 wrote: Monday 22 January 2024 15:02 That's right. I have set this timer to one minute for testing.
When I trigger a motion, the sensor sends out data via MQTT, but oviously motion or tamper does not arrive in Domoticz
I have to see the configuration objects about motion and tamper from MQTT broker autodiscovery topic.
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by Quax1507 »

Here they are:

Motion:

Code: Select all

{
  "name": "shellymotion2-842E14FFCE96 Motion",
  "stat_t": "~info",
  "enabled_by_default": true,
  "uniq_id": "shellymotion2-842E14FFCE96-motion",
  "qos": 0,
  "~": "shellies/shellymotion2-842E14FFCE96/",
  "val_tpl": "{%if value_json.sensor.motion==true%}ON{%else%}OFF{%endif%}",
  "exp_aft": 4320,
  "dev_cla": "motion",
  "device": {
    "identifiers": [
      "842E14FFCE96"
    ],
    "manufacturer": "Shelly",
    "model": "SHMOS-02",
    "name": "shellymotion2-842E14FFCE96"
  }
}
Vibration

Code: Select all

{
  "name": "shellymotion2-842E14FFCE96 Vibration",
  "stat_t": "~info",
  "enabled_by_default": true,
  "uniq_id": "shellymotion2-842E14FFCE96-vibration",
  "qos": 0,
  "~": "shellies/shellymotion2-842E14FFCE96/",
  "val_tpl": "{%if value_json.sensor.vibration==true%}ON{%else%}OFF{%endif%}",
  "exp_aft": 4320,
  "dev_cla": "vibration",
  "device": {
    "identifiers": [
      "842E14FFCE96"
    ],
    "manufacturer": "Shelly",
    "model": "SHMOS-02",
    "name": "shellymotion2-842E14FFCE96"
  }
}
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: ShellyTeacher for Domoticz

Post by lwolf »

Quax1507 wrote: Monday 22 January 2024 16:10

Code: Select all

  "val_tpl": "{%if value_json.sensor.motion==true%}ON{%else%}OFF{%endif%}",
  "val_tpl": "{%if value_json.sensor.vibration==true%}ON{%else%}OFF{%endif%}", 
Yes these templates are not working in Domoticz 2024, but worked on Domoticz 2023.

I do not know why and when it was appeared in the Domoticz code, but i suspect these line messes with "if value_json":
https://github.com/domoticz/domoticz/bl ... r.cpp#L173

To solve this issue "IF"-s are removed from current ShellyTeacher databases.
You could simply download mqtt_templates.txt and mqtt_templates_gen2.txt from github or the latest ShellyTeacher 0.7 which contains the updated databases, and re-teach the problematic devices.
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by Quax1507 »

To solve this issue "IF"-s are removed from current ShellyTeacher databases.
You could simply download mqtt_templates.txt and mqtt_templates_gen2.txt from github or the latest ShellyTeacher 0.7 which contains the updated databases, and re-teach the problematic devices.
Resolved! Thank You very much!
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by Quax1507 »

I have an issue with a Shelly Plus 2PM in roller shutter mode.
I have switched the Shelly to roller shutter mode and installed the script according to: https://github.com/enesbcs/shellyteache ... r-Position
I used V 0.7 of teacher and also re-discovered the 2PM.

I can open and close the blinds, but cannot set position.

Code: Select all

Error: Shelly MQTT: Cover device does not have set_position_topic (shellyplus2pm-d48afc4447d4-roller-0/shellyplus2pm Küche)
Any idea?

Edit: I used the wrong device (roller-0 insted of roller-pos-c) It is working now :D
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: ShellyTeacher for Domoticz

Post by lwolf »

Quax1507 wrote: Friday 26 January 2024 13:50 I have an issue with a Shelly Plus 2PM in roller shutter mode.
I have switched the Shelly to roller shutter mode and installed the script according to: https://github.com/enesbcs/shellyteache ... r-Position
I used V 0.7 of teacher and also re-discovered the 2PM.

I can open and close the blinds, but cannot set position.

Code: Select all

Error: Shelly MQTT: Cover device does not have set_position_topic (shellyplus2pm-d48afc4447d4-roller-0/shellyplus2pm Küche)
Any idea?

Edit: I used the wrong device (roller-0 insted of roller-pos-c) It is working now :D
Yep, but you can also use "Roller Pos (MqttControl)" if you enable "Mqtt Control" option in Plus2PM settings, without any script.
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by Quax1507 »

Thank You! Got it ;)
imautohuttraeger
Posts: 97
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by imautohuttraeger »

I have a Shelly H&T Gen 3 device. It is listed at "Implemented devices" on the Github page. There is no option to check "Detect Gen3 Devices (I am using the Windows Version). However, if "Detect Gen2 Devices" is checked, the following error occures:

ERROR: GEN2 device shellyhtg3-84fce639xxxxx shellyhtg3-84fce639xxxxx template not found

Any idea?
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: ShellyTeacher for Domoticz

Post by lwolf »

Yep, Gen2 and Gen3 seems identical at software side.
Experimental support added 4 days ago. If your mqtt_templates_gen2.txt older than 4 days, please download latest from here:
https://raw.githubusercontent.com/enesb ... s_gen2.txt

Please make sure that this string is in the database:
[shellyhtg3]
imautohuttraeger
Posts: 97
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by imautohuttraeger »

Thx. It seems as if I have messed around with the unzip folder of an old version of the teacher and the new one. The related string once appeared in MQTT Explorer but no device was shown in Domoticz. Then I deleted the related entry via MQTT Explorer (only containing something like "online=false") because somewhere I read that such retained entries must be deleted before scanning for it again.

Sigh! Dummies like me should not delete anything without really knowing what's behind it.
🥴

I am totally clueless now ...
imautohuttraeger
Posts: 97
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by imautohuttraeger »

Anyone any hint how I can "reset" all things (MQTT Broker?) in a way, that Shelly Teacher is able to scan this device again?

Or: Is there any description how to manually integrate a shelly device into domoticz? I have to admit that I can't find anything in the forum and Wiki.
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: ShellyTeacher for Domoticz

Post by lwolf »

imautohuttraeger wrote: Tuesday 30 January 2024 8:25 Anyone any hint how I can "reset" all things (MQTT Broker?) in a way, that Shelly Teacher is able to scan this device again?
Its simple: make the device online and connect it to MQTT. ShellyTeacher will send configuration object again when it sees the device. If the device is not seen, wont be happen anything. If you see online = False under "shellyhtg3-84fce639xxxxx/" or does not see "shellyhtg3-84fce639xxxxx/" at all, than your device is offline. Press its button, remove battery, charger, etc to restart it, and check the device configuration page again.
imautohuttraeger wrote: Tuesday 30 January 2024 8:25 Or: Is there any description how to manually integrate a shelly device into domoticz? I have to admit that I can't find anything in the forum and Wiki.
Sure I did it earlier manually.
I assembled the necessary configuration objects (which are collected in mqtt_templates_gen2.txt) and sent it with mosquitto_sub or MQTT Explorer to the MQTT Broker.

If the Autodiscovery topic is homeassistant and device name is shellyhtg3-84fce639xxxxx than the topic is

Code: Select all

homeassistant/sensor/shellyhtg3-84fce639xxxxx/temperature/config
the payload is

Code: Select all

{"device": {"identifiers": ["84fce639xxxxx"],"manufacturer": "Shelly","model": "shellyhtg3","name": "shellyhtg3-84fce639xxxxx"},"name":"shellyhtg3-84fce639xxxxx Temperature","device_class":"temperature","enabled_by_default":true,"~": "shellyhtg3-84fce639xxxxx/","json_attributes_topic":"~status/temperature:0","state_class":"measurement","state_topic":"~status/temperature:0","unique_id":"shellyhtg3-84fce639xxxxx-temperature","unit_of_measurement":"C","value_template":"{{ value_json.tC }}"}
This is only temperature, more configuration objects exists for humidity, etc... but again: if the device is offline it will not do anything. ShellyTeacher is sending the config object automatically when it sees the device.
imautohuttraeger
Posts: 97
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by imautohuttraeger »

Many thanks for this detailed helping text! Will try tomorrow. But according to the online state: I always press the button for the H&T before I let the teacher scan it (I am leaving the back cover detached for this, as a little hole for a Paperclip is missing unfortunately 😉)
imautohuttraeger
Posts: 97
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by imautohuttraeger »

BINGO! After publishing the autodiscovery topic you have notified above via MQTT Explorer (checked raw format - default json did not work), the teacher finally detected the device.

Thank you very much once again - you are my hero!
lwolf
Posts: 216
Joined: Saturday 10 November 2018 18:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Hungary
Contact:

Re: ShellyTeacher for Domoticz

Post by lwolf »

imautohuttraeger wrote: Tuesday 30 January 2024 16:11 BINGO! After publishing the autodiscovery topic you have notified above via MQTT Explorer (checked raw format - default json did not work), the teacher finally detected the device.

Thank you very much once again - you are my hero!
I am glad if it works.. but other parameters also appeared in Domoticz like humidity?
imautohuttraeger
Posts: 97
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by imautohuttraeger »

Yes. A combined Device showing both temperature an humidity appears. Compare Screenshot.
Screenshot_20240130-212822.png
Screenshot_20240130-212822.png (60.09 KiB) Viewed 999 times
imautohuttraeger
Posts: 97
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by imautohuttraeger »

Screenshot_20240130-214909.png
Screenshot_20240130-214909.png (170.07 KiB) Viewed 993 times
Also an online status switch (not switchable of course) and a power status switch are created. The online status is really shown under tab "switches". But the power status (always on, I guess because mine is usb powered) is shown in the list of devices, but not at the tab "switches" or any other tab - although is is flagged as type = Light / Switch. However, I am happy
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ShellyTeacher for Domoticz

Post by Quax1507 »

I still have the issue that teached devices do no longer work after restart of Domoticz. See https://www.domoticz.com/forum/viewtopi ... 06#p312206

Error in Domoticz:

Code: Select all

Error: Shelly MQTT: Switch not found!? (shellyplus2pm-d48afc4447d4-roller-pos-c/Küche Rollo)
But the device is in the Domoticz devices:
03-02-2024_10-49-51.jpg
03-02-2024_10-49-51.jpg (22.12 KiB) Viewed 865 times
I am using mosquitto and the retain flag is set. How can I troubleshoot? Can I check the retain somwhere in MQTTexplorer?

Any indea? Do You recommend another MQTT broker?

EDIT: there are no devices when I go to Setup -> Hardware -> MQTT Auto Discovery Client Gateway with LAN interface -> Setup
Is this OK??
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest