Hi,
I have multiple networks in my house and because the discovery feature works only in the network where Hass is, I need a way to manually add a shelly device (maybe through IP) that is in a different newtork.
Is there a way I can do this?
Hi,
I have multiple networks in my house and because the discovery feature works only in the network where Hass is, I need a way to manually add a shelly device (maybe through IP) that is in a different newtork.
Is there a way I can do this?
Hi AlexMC,
Have the same issue here… other than opening the network up with multicast… did you get any responses?
Regards,
F
Hi AlexMC,
got it working (by RTFM)…
I’ve achieved to add to HAss Shelly devices that are out of the HAss network (i.e on a parking lot) by using a RESTFull integration and creating sensors out of it pulling data from Shelly cloud. It works like a charm. You will need to:
rest
entry on your configuration.yaml
(following just an example) and populate all sensors coming from that devicerest:
- resource: https:/XXXXXX.shelly.cloud/device/status
method: POST
payload: 'auth_key=<your key>&id=<device out of local network>'
headers:
User-Agent: Home Assistant
Content-Type: application/x-www-form-urlencoded
scan_interval: 5
sensor:
- name: "Wallbox power meter 1"
value_template: '{{ value_json.data.device_status.emeters[0].power }}'
state_class: measurement
unit_of_measurement: W
device_class: power
- name: "Wallbox returned meter 1"
value_template: '{{ value_json.data.device_status.emeters[0].reactive }}'
state_class: total_increasing
unit_of_measurement: Wh
device_class: energy
...
Enjoy
Thanks to jacxon4’s advice I was able to add some Shelly Door and Window sensors using Shelly’s Cloud API.
Posting a few helpful hints that helped me and the code for the Sensors that appear in HASS when its added locally as maybe my fumbling around can save others some time.
Perquisites:
First you need make get your device enrolled into Shelly’s Cloud this means setting up an account, downloading their app and enrolling the device per their instructions.
Once the device is showing up in the app we’ll need to find the device’s unique Device ID and find your unique Server URI address and your unique Cloud authorization Key and then test that you can connect to their Server/Device to pull info.
Obtaining your Server address and Cloud Key:
In the app go to the Settings gear-cog icon. Under the User Settings tab then Access And Permissions click Authorization cloud key and then click Get key:
It will display your unique Server and Cloud key. (FYI: Dont post either of these on the internet but if you do you can change your account password which will invalidate old keys and generate a new one.)
Obtaining Device ID:
Back out of Settings and go to the Device you would like to add to HASS via the Cloud API and click the Settings gear-cog icon on the bottom left. In this example the device ID is listed for the “Basement -Door” sensor
Testing access to your Server & Device:
A Quick way to test that you have access is to open a Command Prompt and type (without < or >):
> curl -X POST https://<YOUR_SERVER>/device/status -d "id=<YOUR_DEVICE_ID>&auth_key=<YOUR_CLOUD_KEY>"
It should return back information about your device include SSID, IP Address, MAC address etc. All of this data can be pulled into HASS.
Example Code for Temp., Batt., & Lux. Sensors and a Binary (Door) Sensor:
(Swap your info into the spots below without < or >).
#Shelly Cloud API - Basement Sensor
rest:
- resource: https://<YOUR_SERVER>/device/status
method: POST
payload: 'auth_key=<YOUR_CLOUD_KEY>&id=<YOUR_DEVICE_ID>'
headers:
User-Agent: Home Assistant
Content-Type: application/x-www-form-urlencoded
scan_interval: 5
sensor:
- name: "Shelly Sensor Basement (Cloud API) - Battery"
value_template: '{{ value_json.data.device_status.bat.value }}'
device_class: Battery
unit_of_measurement: '%'
- name: "Shelly Sensor Basement (Cloud API) - Temperature"
value_template: '{{ value_json.data.device_status.tmp.value }}'
device_class: temperature
unit_of_measurement: '°F'
- name: "Shelly Sensor Basement (Cloud API) - Luminosity"
value_template: '{{ value_json.data.device_status.lux.value }}'
device_class: illuminance
unit_of_measurement: 'lx'
binary_sensor:
- name: "Shelly Sensor Basement (Cloud API)"
value_template: '{{ value_json.data.device_status.sensor.state }}'
device_class: door
This is great, thanks for being so helpful. I do have a question, does the <YOUR_SERVER> mean the Home Assistant address? Example http://192.168.68.51:8123/
Thanks for all your help,
Mike
No, its the server you get from the shelly app when you request the Authorization cloud key, but maybe you already found that out
Has anyone had any success using the Websocket setting described here:
Shelly - Home Assistant (home-assistant.io)
ws://
+ Home_Assistant_local_ip_address:Port
+ /api/shelly/ws
Where IP address is replaced with your publicly accessible address.
I’m using a cloudflare tunnel to access HA remotely, can’t seem to get this work.
I have added Shelly em but how can I add Shelly Plus H&T?
THX very much for your help
I am using this in the web browser and it does not work. Can you guide me please? curl -X POST https://shelly-25-eu.shelly.cloud/device/status -d “id= a8432ab&auth_key= NjA3ODB1aWQ78D38EB11F0E0C6BC8AB9CC3F3AF36C0FA45FE9053F21FE3255128”
Remove your auth key from there please. Possible security risk.
Hello!
Using Shelly’s cloud API, I can reach some sensors, but I cant reach for example apower. Probably code is wrong. What should be instead of ‘switch:0’ ?
“{{ value_json.data.device_status.‘switch:0’.apower }}”
isok: true
data:
online: true
device_status:
'switch:0':
id: 0
apower: 5.4
source: init
output: true
voltage: 229.6
freq: 50
current: 0.051
pf: 0.97
aenergy:
by_minute:
- 98.506
- 95.456
- 95.068
Thank You in advance!
Answer:
“{{ value_json.data.device_status[‘switch:0’].apower }}”
Getting data with rest_command from my two Shelly sensor (Uni & 3EM) in an external network stopped working for approx. 1 month ago.
Been working perfectly before this.
Could someone advice?
Is it related to Using rest_command is no longer an option with binary responses · Issue #118904 · home-assistant/core · GitHub?
Suggestions how to solved?
Setup in configuration.yaml
Rest:
- resource: https://shelly-114-eu.shelly.cloud
method: POST
payload: 'Removed'
headers:
User-Agent: Home Assistant
Content-Type: application/x-www-form-urlencoded
scan_interval: 10
sensor:
- name: "Bjornidet Elpanna0"
value_template: '{{ value_json.data.device_status.emeters[0].power }}'
state_class: measurement
unit_of_measurement: W
device_class: power
- resource: https://shelly-114-eu.shelly.cloud
method: POST
payload: 'Removed'
headers:
User-Agent: Home Assistant
Content-Type: application/x-www-form-urlencoded
scan_interval: 10
sensor:
- name: "Bjornidet Elpanna1"
value_template: '{{ value_json.data.device_status.emeters[1].power }}'
state_class: measurement
unit_of_measurement: W
device_class: power
- resource: https://shelly-114-eu.shelly.cloud
method: POST
payload: 'Removed'
headers:
User-Agent: Home Assistant
Content-Type: application/x-www-form-urlencoded
scan_interval: 10
sensor:
- name: "Bjornidet Elpanna2"
value_template: '{{ value_json.data.device_status.emeters[2].power }}'
state_class: measurement
unit_of_measurement: W
device_class: power
- resource: https://shelly-114-eu.shelly.cloud
method: POST
payload: 'Removed'
headers:
User-Agent: Home Assistant
Content-Type: application/x-www-form-urlencoded
scan_interval: 10
sensor:
- name: "Framledning"
value_template: '{{ value_json.data.device_status.ext_temperature[0].tC }}'
state_class: measurement
unit_of_measurement: C
device_class: temperature
- resource: https://shelly-114-eu.shelly.cloud
method: POST
payload: 'Removed'
headers:
User-Agent: Home Assistant
Content-Type: application/x-www-form-urlencoded
scan_interval: 10
sensor:
- name: "Returledning"
value_template: '{{ value_json.data.device_status.ext_temperature[1].tC }}'
state_class: measurement
unit_of_measurement: C
device_class: temperature
- resource: https://shelly-114-eu.shelly.cloud
method: POST
payload: 'Removed'
headers:
User-Agent: Home Assistant
Content-Type: application/x-www-form-urlencoded
scan_interval: 10
sensor:
- name: "Varmvatten efter VXLventil"
value_template: '{{ value_json.data.device_status.ext_temperature[2].tC }}'
state_class: measurement
unit_of_measurement: C
device_class: temperature
Bule did you ever get this working? I am trying to do the same thing. Thanks in advance for your help.