Restful API Switch for www.smart-me.com

Hi there.

This is my very first post on this community. I really like Home Assistant and see alot of potential in this software.
My knowledge now is that i’m avaible of switching things over mqtt. Also reading temperature over MQTT is no problem.
My question is how does it work with RESTful Switches?
A year ago i bought a switch from www.smart-me.com. They have also a API https://smart-me.com/swagger/ui/index. They call it smart-me REST API. Actually i think it’s well documented there when someone has the right know how.
I was also able to switch the Smart-me switch with https://smart-me.com:443/api/Devices/XXX?switchState=true&switchNumber=1. XXX is for the ID of the Product
How can i implement in the configuration.yaml a switch or sensor?

Best regards
Buhi

Hi there.

Is really nobody that can help me?

Over the API Website i’m able to switch the relais. https://smart-me.com:443/api/Actions
I know this webpage contains something to login with HTTP auth basic. Of course i have a username and a password for it.

This is the code to switch the device. I just need to change the value from 0 to 1.

{
 "DeviceID": "3508XXXX-XXXX-XXX-882f-a8dbdb28eeac",
  "Actions": [
   {
     "ObisCode": "63000C0001FF",
     "Value": 0
   }
  ]
}

How is it possible to implement in HASS? Or does somone know how to do a PHP file wich will switch the relais?

Best regards

It’s not that no one is able to help you. It’s that there is a component in HASS that handles this already and it’s well documented and easily Googled (“RESTful Switch Home Assistant”).

Google is your friend. That page (literally the first result) tells you exactly what you need to configure it.

If for some reason you try to set it up and fail, then, in a new topic, if you post your configuration and the issue you’re having, you open yourself up to being helped. As this is worded, you’re not asking for help, you want someone to do it for you.

I tried more than 8 hours just on that but i can’t figure it out.

HASS gives me in the console a message about endpoint offline.
Does somone see what i’m doing wrong?

Best regards.

At least i found out now how to implement a sensor with the REST API for the smart-me Switch.

  • platform: rest
    resource: https://smart-me.com:443/api/Devices/XXXXXXXXXXXXX
    username: xxxxxxxxx
    password: xxxxxxxxx
    authentication: basic
    name: Temperature
    value_template: ‘{{ value_json.Temperature }}’
    headers:
    Content-Type: application/json
    User-Agent: Home Assistant REST sensor

With that i can extract the temperature out of the json code.
If i will find out about how to Switch i will upgrade this Information also here.