I just logged in and haven’t introduced myself yet. I’m a bit older but also new here. My name is Nick, and I dabble in IT and “smart” stuff from time to time, mostly at home.
Anyway, currently, I’m trying to prevent my heater and my home battery from arguing with each other. Both are trying to consume the surplus PV power, with the battery system naturally being faster than the heater. Later on, the heater punishes it by ruthlessly draining it empty. Not ideal. It would be better if I could distribute the surplus power. Since I lack the appropriate system, I started integrating and rudimentarily controlling the systems. I found a guide regarding my heater here: [Link to the guide]
However, I didn’t feel like installing Node-RED, so I wanted to solve everything using REST commands and automation. Based on the guide, I added the following entry to my configuration.yaml:
rest_command:
sme_auto:
url: http://username:password@ipaddress/menupage.cgi?page=0301580E&changeadr=039003301D&changeto=2
method: GET
This link isn’t correct, but I can paste the one from my configuration.yaml into my browser, press Enter, and the action triggers on my heater. So, it should work.
I designed the automation as follows for testing:
alias: Test RESTful
description: ""
trigger: []
condition: []
action:
- service: rest_command.sme_auto
data: {}
mode: single
That’s all. As you can see, without any triggers. I have to manually trigger the automation. In my opinion, this should work. I’ve also restarted HA. But when I trigger the automation, my heater doesn’t respond. Since I’m stuck, I thought I’d reach out to you guys.
Hey, that’s really great, I hadn’t thought of that at all. I just tried it and it was also quoted with a green checkmark. However, nothing happened, so there was no reaction from the heater.
Have a look in your browser DevTools (usually F12) to see what the request headers are when you send the response. Then duplicate those in the rest command.
Perhaps you need to supply username and password separately rather than building it into the URL.
You are right. I tested that with the browser’s incognito mode. You actually have to log in first for any changes to take effect. But how do I do that now? I tried it here, but it seems to be incorrect.
rest_command:
my_request:
username: user
password: pass
url: http://ipadress/menupage.cgi?page=0301580E&changeadr=039003301D&changeto=1
method: GET
I’m writing here again because I could gather some information. It seems that with the x2 devices, unlike with the UVR1611 as mentioned in the post by @Holo_San, things are a bit different. For some reason, the TA seems to enjoy appending an x or x2 to them. So, for example:
When I enter this URL in the browser, even in incognito mode, even after clearing the cache, the URL works.
However, attempts with curl fail. By “fail” in this context, I mean that the desired change does not occur on the recipient’s side.
curl -X GET -u username:password http://ipaddress/menupagex.cgi?pagex2=01005800#01045800&changeadrx2=01000C40DA1202&changetox2=2
And also, the rest_commandmy_request and my_2_request fail. In the devtools under services, after triggering successfully, I receive a status 200. I have also contacted TA support now; perhaps they might know something.