Local cast, virtual thermostat

Is there a way to create a virtual thermostat that appears on the dashboard? That way, I could send information to Node-RED about the desired temperature in the house and activate the heating. I’ve been searching for information for days, and the only thing I’ve been able to create is a virtual light, outlet, and thermometer. But I haven’t been able to create any input space to send data to Node-RED.

In iHost not posible.

It’s a shame, because this system has the power to create a good ESCADA system and it can’t be done.

I think so too. But the development of cubeos simply stopped. iHost has potential but remained unused maybe forever.

Could you describe your requirements in detail?
CUBEOS supports creating virtual devices through the Open API or via Node-RED. Please refer to this API documentation: eWeLink CUBE Open API V2 - eWeLink.
It enumerates the interfaces and capabilities supported by the Open API, enabling you to design a virtual device tailored to your needs.

I’d like to create a thermostat to select a temperature, using some kind of slider or a field to enter a number. Then, with that value in Node-RED, I could control the heating system, turning it on or off.

I’m assuming you’ve already synchronized devices via the Open API and understand the end-to-end flow for syncing and controlling them.

Unfortunately, because thermostatic valves are relatively complex, the Node-RED plug-in does not support synchronizing this type of device; however, you can still control them through the Open API.

Note:

  • Replace the IP address 10.10.10.214 with your iHost’s IP.
  • Replace the port 1880 with your Node-RED’s port.
  • Replace the iHost token with your iHost token.

Steps

  1. Synchronize a simple thermostat via cURL
curl --location --request POST 'http://10.10.10.214/open-api/v2/rest/thirdparty/event' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 633bc246-df8e-4b36-9e7c-40028cbfa768' \
--data-raw '{
  "event": {
    "header": {
      "name": "DiscoveryRequest",
      "message_id": "4105a704-22b0-4969-9cb9-c3078041a800",
      "version": "2"
    },
    "payload": {
      "endpoints": [
        {
          "name": "thermostat",
          "third_serial_number": "a400016f28",
          "manufacturer": "SONOFF",
          "model": "thermostat",
          "firmware_version": "1.0.3",
          "display_category": "thermostat",
          "capabilities": [
            {
              "capability": "temperature",
              "permission": "0110"
            },
            {
              "capability": "thermostat-target-setpoint",
              "permission": "1100",
              "name": "manual-mode",
              "settings": {
                "temperatureRange": {
                  "type": "numeric",
                  "permission": "01",
                  "min": 4,
                  "max": 35,
                  "step": 0.5
                },
                "temperatureUnit": {
                  "type": "enum",
                  "permission": "11",
                  "value": "c",
                  "values": [
                    "c",
                    "f"
                  ]
                }
              }
            },
            {
              "capability": "thermostat",
              "permission": "1100",
              "name": "thermostat-mode",
              "settings": {
                "supportedModes": {
                  "permission": "11",
                  "type": "enum",
                  "values": [
                    "MANUAL",
                    "AUTO",
                    "ECO"
                  ],
                  "value": "MANUAL"
                }
              }
            },
            {
              "capability": "thermostat",
              "permission": "0100",
              "name": "adaptive-recovery-status"
            },
            {
              "capability": "battery",
              "permission": "0100"
            },
            {
              "capability": "lqi",
              "permission": "0100"
            },
            {
              "capability": "rssi",
              "permission": "0100"
            }
          ],
          "state": {
            "battery": {
              "battery": 100
            }
          },
          "service_address": "http://10.10.10.214:1880/api/v1/open/device/a400016f28"
        }
      ]
    }
  }
}'

And you’ll see your device in iHost and the slider you needed.

  1. Create a Node-RED flow to handle requests
    Paste the following flow into Node-RED:
[
    {
        "id": "063368d2d718607b",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "f63674954a284868",
        "type": "http response",
        "z": "063368d2d718607b",
        "name": "return code",
        "statusCode": "",
        "headers": {},
        "x": 910,
        "y": 1120,
        "wires": []
    },
    {
        "id": "45b171c3a9db0ad5",
        "type": "http in",
        "z": "063368d2d718607b",
        "name": "server for thermostat",
        "url": "/api/v1/open/device/a400016f28",
        "method": "post",
        "upload": false,
        "swaggerDoc": "",
        "x": 250,
        "y": 1120,
        "wires": [
            [
                "4ca5647fd410116b",
                "469527605d4bca17"
            ]
        ]
    },
    {
        "id": "4ca5647fd410116b",
        "type": "debug",
        "z": "063368d2d718607b",
        "name": "debug 9",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 390,
        "y": 960,
        "wires": []
    },
    {
        "id": "469527605d4bca17",
        "type": "function",
        "z": "063368d2d718607b",
        "name": "function 1",
        "func": "const data = msg.payload;\n\nconst messageId = data.directive.header.message_id;\n\n// do anything you like in here\n// ....\n\nmsg.temperature = data.directive.payload.state['thermostat-target-setpoint']['manual-mode'];\n\n// then return the result as success\nconst response = {\n    event: {\n        header: {\n            name: 'UpdateDeviceStatesResponse',\n            message_id: messageId,\n            version: '2',\n        },\n        payload: {}\n    }\n}\n\nmsg.payload = response;\nmsg.statusCode = 200;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 580,
        "y": 1120,
        "wires": [
            [
                "f63674954a284868",
                "5bb432689c5a1ac0"
            ]
        ]
    },
    {
        "id": "5bb432689c5a1ac0",
        "type": "debug",
        "z": "063368d2d718607b",
        "name": "debug 7",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "temperature",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 700,
        "y": 960,
        "wires": []
    }
]
  1. Control the device
    Operate the slider; you should see the temperature changes arrive in Node-RED. Then you’re free to do anything you need with the temperature.

I’ve never done this before, and it will be a challenge for me. Thank you for everything. Let’s see if it goes well. XD

This doesn’t help me and is still unusable for my projects!

And are there any Zigbee or Wi-Fi thermostats for Sonoff iHost that can pass data to the network node?

What exactly are your specific requirements?

A customer has purchased NSpanel pro and wants to control the heating. The problem is that it is not possible to add more than one device. The situation is that he turns on the heat pump and needs to open a valve in the manifold to start the heating in the desired room.

Realistically, which ordinary person knows what cron is and how to use it. if they want to change something, they will keep calling. The solution is virtual temperature control where I can connect your device at will…

curl --location --request GET ‘http://“number IP”/open-api/v2/rest/bridge/access_token’ --header ‘Content-Type: application/json’

I can’t get the token, what am I doing wrong?

C:\Users\JCC>curl --location --request GET ‘http://“IP”/open-api/v2/rest/bridge/access_token’ --header ‘Content-Type: application/json’
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (6) Could not resolve host: application

Your use of quotation marks is incorrect — here’s the correct example.

curl --location --request GET 'http://<YOUR-IHOST-IP>/open-api/v2/rest/bridge/access_token?app_name=YOUR-APP-NAME'   --header 'Content-Type: application/json'

I added the quotation marks so you’d know I’m putting the IP address there. I’m writing it like this so you understand: curl --location --request GET 'http://0.0.0.0/open-api/v2/rest/bridge/access_token' --header 'Content-Type: application/json'

But even if it’s different, what should I put in the app-name? The API manual doesn’t specify that.

The app-name is simply an identifier to help you recognize the source of a device. The system does not use it for any functional operations.
It cannot be left empty; simply enter any string you find suitable.

I have completely cancelled the thermostat from you. It is unusable and it is a shame for your products.

.

Are you referring to the TRVZB device?

I understand your need as something like a virtual thermostat — a solution that offers more flexible and highly controllable heating management.
This requirement is already under research and design on our side, and we plan to introduce it in the near future.

I do various heating, if you want advice, write to me. I have real experience from practice and I will be happy to share it if you are interested.

Thx