Thats amazing!
Hi everyone,
in the documentation I was unable to find indications on how to set a specific option in a select entity, via an object in the SVG file.
In the developer tools I successfully tested a call like this:
action: select.test
target:
entity_id: select.test
data:
option: AAA
But I don’t know how to bring it back to yaml for the floorplan.
I tried with the following but they are not the right way:
First:
- element: button-test
entity: select.test
tap_action:
action: call-service
service: select.select_option
data:
option: AAA
Second:
- element: button-test
entity: select.test
tap_action:
action: call-service
service: select.select_option
target:
entity_id: select.test
data:
option: AAA
I get the error:
Unable to perform action: select/select_option required key not provided @ data['option']
Thanks to those who will give me valuable suggestions
You can try service_data
instead of data
. If that doesn’t work you can call a script and put your action in there
This works for me
- element: preset_1
tap_action:
service: select.select_option
service_data:
entity_id: select.tt_8l_gatekeeper_move_to_preset
option: Entry
Thanks a lot!
It worked
I guess I’ll need to add a task about exposing the data as “data”, and support the data
attribute, too.
Hi everyone,
I created an object in Inkscape that simulates a button.
Now I have two questions:
- when I tap on the button, how do I set a text in an input_text type entity?
I tried in the following way but it doesn’t work:
- element: button-myBytton
tap_action:
service: input_text.set_value
service_data:
entity_id: input_text.myInputText
value: sample text
- Is it possible to assign two (or more) actions to perform when tapping on the element button-myBytton?
Thanks
To be honest I haven’t tried multiple tap actions but here is the syntax for multiple state actions which would be the same if supported
state_action:
- service: floorplan.text_set
service_data: '${entity.state != "unavailable" ? Math.ceil(entity.state) + "°" : "?"}'
- service: floorplan.class_set
service_data: |
>
if(hass.states["sun.sun"].state === "below_horizon")
return "always-visible";
else
return "always-invisible";
In theory all HA actions are supported but you haven’t explained what you mean by “doesn’t work”. Certainly you can call scripts which could do this:
- entities:
- script.dinner_time_bell
name: Scripts
tap_action:
service: script.turn_on
-
Unsure if it would make a difference but the documentation has value and entity_id in the reverse order, at the very least I’d think that ‘sample text’ should be inside quotations.
-
Can confirm OzGav’s suggestion, one action with multiple service calls. This works for me.
tap_action:
- service: floorplan.class_set
service_data:
elements:
- popup_lighting
- popup_scenes
class: "layer-hidden"
- service: floorplan.class_set
service_data:
elements: *tiles
class: layer-visible
Hi!
I tried as follows and I don’t see any errors in the floorplan log and/or in the Chrome console:
- element: button-espresso
tap_action:
- service: select.select_option
service_data:
entity_id: select.coffee_drink
option: Espresso
- service: input_text.set_value
service_data:
entity_id: input_text.coffee_bevanda_selezionata
value: "Espresso"
By “it doesn’t work” I mean that the input_text is not valorised, in this case with “Espresso” but remains at its initial value.
So I tried the second way, using the following script:
coffee_set_espresso:
sequence:
- service: input_text.set_value
target:
entity_id: "input_text.coffee_bevanda_selezionata"
data:
value: "Espresso"
If I launch the script manually from the developer tools section, the input_text is valued as I expect. So I tried with:
- element: button-espresso
tap_action:
- service: select.select_option
service_data:
entity_id: select.coffee_drink
option: Espresso
# - service: input_text.set_value
# service_data:
# entity_id: input_text.coffee_bevanda_selezionata
# value: "Espresso"
- service: script.turn_on
service_data:
entity_id: script.coffee_set_espresso
value: "Espresso"
But the script is not triggered by this code.
And, as confirmation, I see that the last execution dates back to the manual launch of the script:
I also have another question to ask the community:
In the floorplan I would like to insert an animated “indeterminate progress bar” overlaid. I was thinking of overlaying an animated gif but in this way I only see the bar if I open the .svg file directly from the browser, so I have to find a solution.
In this example from the documentation there is something similar (although I would like the bar horizontal, not vertical, and only one color):
I tried to copy the elements of the example into my florplan but the bar it doesn’t move.
The question is:
Has anyone already created an ‘indeterminate progress bar’ in the floorpanel and/or can give me suggestions on how to create it and/or where I can find out more?
Thanks
I would suggest just using the script you now have and have floorplan call that. See my post two above yours for the yaml
Animated SVGs work
You should be able to get the bar working as shown in the example. What happens when you try?
I tried to reproduce it but, obviously, I don’t have the entities on my HA.
I see that there is the simulations.yaml file which contains the entities and starts with:
simulations:
- entity: sensor.wind_direction
states: |
>
var MIN = 0;
var MAX = 360;
var STEP = 10;
var currentLevel = entity.state ? entity.state : MIN;
var level = (currentLevel + STEP) % MAX;
return {
state: level,
duration: '25ms'
};
I searched on the web but I didn’t understand what “simulations:” stands for and how to use it (it doesn’t seem like an integration…)
I also inserted the simulations.yaml file in the directories of the .svg and .css files but the result is this:
So how do I simulate those entity?
Thanks for the support
You could just create an input number and use that.
i have a dishwasher that has state that outputs a timestamp like this:
2024-09-26T23:58:11+00:00
how can i create a text set that also converts the timestamp into hours and minutes remaining.
i already added the text into the svg and yaml. but i see stue c
Try googling “home assistant timestamp format”
Edit: if you are trying to do it from within the floorplan code then you need to use JavaScript Date and time
Hello everyone,
could someone please help me understand how to use simulations:
at this url:
ha-floorplan/docs/_docs/floorplan/examples/home at 6260f120a516c6234d5ebed6b5299ecf1da4163f · ExperienceLovelace/ha-floorplan · GitHub /simulations.yaml
Thank you
That’s just for the docs.
You need to use you own HA sensors when creating your floorplan.