I am currently installing a homeassistant. I connected several services in the homeassistant and all devices work fine in the homeassistant. I can switch and dim them in homeassistant.
Now I try to access the functionalities with node-red, which I installed with the Homeassistant aswell. I already managed to switch the devices on and off, by using a “home assistant action” node. The action I chose was “homeassistant.turn_on” and selected the device.
But at the moment I have no clue how I would dim it.
All entities and devices arrive in Home Assistant from an integration that creates them. Where appropriate, each integration will also add Actions (formerly Services) that can be used to do things to the entities belonging to that integration.
As a start, HA comes ‘out of the box’ with a couple of ‘default generic’ Actions, including homeassistant.turn_on. These HA actions will work with almost anything that looks to HA like a switch, which makes life nice and easy if you just want to turn things on and off.
To do other stuff, you need to go back to the integration that ‘owns’ the device / entity / thing and see what Actions it has added to HA. The easy way to do this is to read the documentation and to use the Developer > Actions tab in HA, where you will probably find something along the lines of
light.turn_on
where ‘light’ is the name of the integration/platform, and ‘.turn_on’ is (one of) the actions added by that integration. Note that ‘homeassistant.turn_on’ and ‘light.turn_on’ are two quite different actions.
homeassistant.turn_on does nothing more than turn on, however light.turn_on offers options (depending on the light device) for things like ‘brightness_pct’. If you have a light-switch, then ‘light.turn_on’ will not accept any options, but I expect that your device, once you select the target entity for the action, will offer additional options including ‘brightness_pct’. Then it just becomes a case of testing in HA to run the correct action on the entity with the necessary parameters, and transferring this to Node-RED. The extra options go in the Action node Data field as something like
Hi @Biscuit,
yes, indeed. That helped.
Seems like homematic has built this is bit complicated.
There is no “light” or anything else, but a “homematicip_local”, with an action “set_device_value”.
Here you need to define all data that shall be sent to the homematic xml-api.
For me it looks like this:
A bit strage, but working now. Would prefer the other way, with selecting the device directly, like it is offered for the “turn_on” action with homeassistant.
Actions (service calls) in Home Assistant are indeed a bit of a minefield. I don’t have a homematic device, but I have learnt that you need to dig around to find out just what the integration has added by way of Actions. Every single integration / action is different, and the nice ones are very easy to use. It looks like your integration talks out via a ‘hub’ to several devices, and each one has an address so you are effectively broadcasting with an address and parameters.
If you have just the one action ‘set_device_value’ and it needs all that data, you might consider using a bit of code to make life easier. If you have an array of device-addresses, and want for example to turn lights to a given brightness, then the following JSONata used in a Change Node will turn an input msg.payload as string “hall on” into the data block you need.
Then you might then be able to address each ‘device’ directly with a command
msg.payload = “hall on”, “hall off”, “lounge low” and so on.
Since msg.payload can be used as an input override in the Action node, it might be better to use msg.command.
If your data object is the one required for Data in the Action node, then you can use JSONata directly there - just change $split(payload, " ") to $split(command, " ") and use msg.command set as required.