Hi everyone,
I’m a ‘novice’ with both HA and Floorplan.
My question is:
Using a binary-sensor in HA I would like to simulate the flashing of LEDs on a control panel recreated with a .svg file…
In the attached image I would like to turn on/off, for example, the small blue circle.
Hi Giovanni,
You should create the little blue circle in your SVG and assign it the same ID as your sensor name which might be binary_sensor.coffe_LED_startPause
For this one I am not 100% sure what your floorplan looks like but if you just want to touch anywhere in the room and turn on the light and have the whole room change colour then just make the ID of the rectangle the same as the light entity and use the code I just posted.
If however you want to be able to touch ONLY the light bulb icon but change the background image then there are probably a number of ways to do that. My way might not be the most efficient but I use a input_boolean as a flag to control the state of the room background. I then have an automation to keep the flag in sync with the light. For example:
automation:
- alias: Abigail Bedside Floorplan Sync
mode: restart
trigger:
- platform: state
entity_id: light.abigail_bedside
to: "on"
- platform: state
entity_id: light.abigail_bedside
to: "off"
action:
entity_id: input_boolean.abigail_bedside_light_flag
service_template: "input_boolean.turn_{{trigger.to_state.state}}"
then in my ui-lovelace.yaml I have:
- entities:
- input_boolean.abigail_bedside_light_flag
- input_boolean.abigail_room_light_flag
- input_boolean.bookshelf_light_flag
name: Control Visbility of Elements
state_action:
service: floorplan.class_set
service_data:
class: '${(entity.state === "on") ? "room-light-fadein" : "room-light-fadeout"}'
area.bathroom are the ID defined in the SVG for my bathroom, and group.bathroom are my HA-entitiy.
You need to change the YAML manually - that’s not configured with a GUI.
If you’re facing any issues, please raise a question in our Discussions section on GitHub. By doing so, it’s much easier for other people to find answers to specific questions in the future
Is it important to use an SVG file or is it possible to use a png image? I do not und
If we need an svg, why this type of file?
Can I convert a png image into svg?
I believe that’s how HAs front end works. Certainly by using SVG you are the able to apply styles to elements and control the behaviour of the interface. PNG is just a binary image file but SVG files are text files which define the graphics in XML format
OzGav are right. Ha-floorplan are using the entities within our SVG-file. Each of them needs to have a ID. Without that, it’s just a “dumb” image, with no references or what so ever
Tip:
You’re able to add a image as the background. I’ve done that myself.
My floorplan are not “live” in the examples-area right now, but that just a image - and transparent objects added on top:
And if you have any specific question, please head over to our dedicated community area. I really like the HA Community, buts it’s just way better to have individual threads for each question. And it has a WAY better SEO impact too, if people are using Google to find answers related to ha-floorplan
We will need some more info to help but first I would suggest that if you installed manually then undo that and then install via HACS. That will make sure it is all installed properly. Follow the instructions here https://experiencelovelace.github.io/ha-floorplan/docs/quick-start/ Pay particular attention to step 5. Remember to add the /hacsfiles/ha-floorplan/floorplan.js as a module to your resource file - like you do with other modules.
Hi @OzGav, thanks for your prompt reply!!
Sorry, i am beginner with HA so, I followed every steps, even the step 5 as you see in the screenshots attached.