Basic help needed #595
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
|
Hi, Thank you for reaching out. Please format your YAML code. There is a explainer on how to do that, at the link destination next to the input field. Also, please share your SVG. The more simple, the better. With that said, you’re not using our service calls, so the code will never work. Please check our examples, or my YouTube video found here: You can also take a look at style_set here: Mayer you’re mixing the Home Assistant build-in options, with our service options in ha-floorplan. Just a small copy from above source: rules:
...
- element: zone_entree
entity: binary_sensor.entree_occupancy
state_action:
action: call-service
service: floorplan.style_set
service_data:
style: |
> if(entity.state === "on"){
return `fill:pink;`;
}else if(entity.state === "off"){
return `fill:purple;`;
}This is a bit of a complicated way of doing this, however, it's one of many way's of doing it. As you're asking for something simple, the value for service_data can also be simplified to a one-liner, as the "style_set" service will see the value within "service_data" as "style". Here's one rule, which should fit your need. rules:
- element: zone_entree
entity: binary_sensor.entree_occupancy
state_action:
action: call-service
service: floorplan.style_set
service_data: "${entity.state === 'on' ? 'fill:pink;' : 'fill:blue;' }"If the fill doesn't change, try temporary setting !important after the fill style, like: `'fill:blue!important;'. |
Beta Was this translation helpful? Give feedback.
-
|
Hello exetico and thank you for your answer. I will check out you youtube video. I quickly browsed your yaml file and it seems to be much more complicated compared what i'm trying to do -> just change a color in an named area. There will be no user interaction with the plan. |
Beta Was this translation helpful? Give feedback.










@osmaterdca Rules needs to be within the config element. It’s actually written in the sceeenshot you’re sharing, too. :)
Secure rules are at the same level as image, stylesheet and so on.