I found this information about HA related to number entity:
But I don’t see (or understand) how to create one. The input_number is working but it has that slider bar on top. I don’t want to be able to change the value by hand. I need a place to store a number coming from another source. Can someone show me an example on how to create a number entity? It is not part of the HELPER.
But then, this is just a template using the input_number that I created. Also, I dont seems to be able to write into a sensor from an external source using REST API command. Sorry if I’m not 100% clear… I’m pretty new in this, and searching a lot.
You are not supposed to add the input number there it’s the “unknown” source.
It’s always better for everyone, especially the one asking, to post as much as possible of the details.
OK, Reading more about your suggested solution will not work I think. Here it is:
I have a system to monitor the energy usage in the house. This was my own built. It is amazingly accurate and I wish to keep it. But I would like to send the information from it to the HA system. I’m using the REST API command inside the python application. From the REST API, I see the list of services availables that includes the input_number, the number and several others. But nothing about variables.
Right now I’m able to do it all with the input_number but the slider bar is scaring me. I dont want to be able to change the value coming from my system within HA.
Not sure if that is enough info for you. Else, I’ll try to make something simple to show cause right now it is a mess.
If the call to send data is from outside, then the solution would probably be a trigger based template sensor. The trigger would be the data coming in through a webhook. When doing it this way the sensor will be immutable from the HA user interface.
Note that the webhook example uses an automation. With a trigger based template sensor that automation isn’t needed, but the trigger is the same. Also note that while number entities are possible here, you probably do not want one. You do not need the services to set it anymore if the value comes from the trigger. Just use a simple sensor type and a unit of measurement.
OK, I think I need more info. I kept reading your message and re-read, but I cannot make it up entirely.
OK, I created a webhook trigger via an automation. From my old system, I can send the value. I see in the webhook that it gets triggered. But that is as far as I could go. I tried several different things but I don’t understand it all. And all the examples I find simply call a service like turn on. I don’t see how they take a value sent from the POST command into a sensor.
I dont know what the action should be.
Not sure to understand this. My webhook config looks like this:
id: '1737751982335'
alias: test webhook
description: ''
triggers:
- trigger: webhook
allowed_methods:
- POST
- PUT
local_only: true
webhook_id: monid
conditions: []
actions:
- action: number.set_value
metadata: {}
data: {}
mode: single
You don’t. The number.set_value action requires a number entity as a target. Automations do not create entities. The entity must be created by an integration.
Using a number entity will not solve the problem you are trying to solve. As 5 of the previous comments have stated, you need to create a sensor.
You should be able to copy/paste the sensor configuration from my previous post directly into your configuration.yaml file to achieve your goal. Don’t forget that you will need to restart HA after altering the file to load the configuration changes.
ha!!! I see now. There was no need at all for the automation.
created the sensor (finally understood lol)
OK, Got it. It is working now. Except that I see now that a webhook has no return value. i.e. I have no way of finding out if HA received my data or not. I tried sending to an invalid name (for testing) and the result returned by the POST command is the same (200).