I need a "dummy sensor" that can be assigned a value from API


  • For a “on/off” sensor this can be done with input_boolean by calling input_boolean (toggle, turn_on, turn_off)

  • For a “date and time” sensor this can be done with input_datetime by calling calling input input_datetime.set_datetime (date, time, datetime)

But what I no need is to set a sensor value (like temperature, cpu usage, drive space ect).
I found input_numbrer, but it looks like this is more a way to change value from GUI, and I can’t see that it is callable (may be because I have non?)

I also found Template Sensor, but for what I see that only support “sensors which get their values from other entities”, and that is not the case here.

Can anyone lead me in the right direction?

You can use a custom_component

It’s possible to set states and attributes.

You don’t explain what the value is, where you get it and what it’s used for.
Do you need a value that is read only or are you okay if your users change it themselves?

Thanks, I will check this out. @VDRainer

It must be read-only from GUI, btw, I see I have asked this before with a better explaination here: https://community.home-assistant.io/t/i-need-a-dummy-sensor-that-can-be-changed-from-api @Mutt

Okay, it’s not good practice, either for people helping you or (say) a newbie looking for a similar solution, to have to read other threads.
It not fully explained even on your other thread.
It seems that you want a diskspace sensor but not ‘live’ just updated… Once a day? Once a week?
And you need it to survive reboots
So, define (in this thread) what you want and how you expect it to behave.
That way anyone coming across this will have a clear understanding and can help you, at the moment we are thrashing around in the dark.
(Having seen the solutions and the quality of the people who have provided them)

I would implement this via an MQTT sensor. All you need to be able to do is to publish an MQTT message then.

Well, yeah, I want a sensor that just update when it got information. if it is remembering the state on reboot, or set a default value like “0” is not that important,

Same here !

Looks like I got this working :slight_smile:

PowerShell module btw: https://github.com/flemmingss/Home-Assistant-PowerShell-Module

1 Like

Maybe create a template sensor based on the input_number.

Looks like the hass-variables works perfect.
I will share my setup when done if anyone else are interessted