#Setting up a Boolean

1 messages · Page 1 of 1 (latest)

lofty cave
#

I am trying to setup a boolean in file editor, for creating a toggle for a tv remote (power on and off).
When I go into the File Editor and select the Configuration.yaml what are the next steps? I have looked online and through the search in here, but I am not finding the step by step to complete an adding a boolean. The code I am trying to input is:

input_boolean:
tv_toggle:
name: TV Power Toggle
initial: off
icon: mdi:power

I have attached a screenshot of where I am needing to go to. I wanted to know if there is a step by step someone can provide for me.

Thank you in advance for all for your assistance

obsidian wolf
#

You can do this in the ui under settings>devices & helpers>helpers

lofty cave
#

Let me take a look @obsidian wolf

#

I actually put Power toggle in Helper, but it does not ask for any coding

#

@obsidian wolf

obsidian wolf
#

Stop pinging me. I’m following the topic.

#

You just make a Boolean/toggle helper and then build an automation that does what you want when the toggle is “on” and what you want when “off”

lofty cave
#

I apologize about the pinging.

#

So the automation would I be using yaml? or just doing the normal triggers? I apologize about the basic questions. I am new at this

obsidian wolf
#

You can make the automation in the ui too. You very rarely need to use yaml these days for basic things.

lofty cave
#

So if I am trying to create a toggle for the power of a tv (on and off), what would I select for manual event?

obsidian wolf
#

Essentially, you're going to make an automation with (minimum) two triggers driven off the two states of the Boolean toggle. Then set a "Trigger ID" for each trigger (which is essentially a friendly name, can be done via the UI)— use “on” and “off”

In the "then do" section, have an action of "choose" with options for each of your power scenarios.

Condition of each scenario would be "Triggered by" with one of the "trigger id" you created in the "When Section" selected. "Action" would be turn on/off whatever when the specific toggle option is selected.

For this, it would be smart to set automation mode to “queued.”

#

No manual events.

lofty cave
#

Let me see if I can follow your instructions. LoL

#

When I am looking at the triggers which would I end up needing to use?

#

I think I did a Webhook when I testing ti before the other day. Not sure if that is what would be recommended. But I did an automation for on and one for off

#

Should I be combining them?

obsidian wolf
#

You want to use the entity state in the trigger, twice— once for each state of the Boolean you should have made.

#

What are actually turning on or off the tv or a smart outlet?

lofty cave
#

I am trying to do the TV

obsidian wolf
#

Not what I’m asking

lofty cave
#

I am trying to turn on the actual smart tv and off

#

But I did do this,

obsidian wolf
#

Ok. And do you have the smart tv integrated to home assistant?

lofty cave
#

I put in this under trigger (webhook) http://<your_home_assistant_url>/api/webhook/toggle_tv_power
(I replaced the beginning to my ip for home assistant, and toggle_tv_power for entity id) and seemed to work

#

Yup, I have it integrated to home assistant 🙂

#

I am trying to go further with creating automations,

obsidian wolf
#

Can you show me what you see under devices and services

#

For the tv

lofty cave
#

KK.

#

I do have more on the devices page

#

Wops you said tv

#

My bad. one sec

obsidian wolf
#

Under the integrations tab

lofty cave
#

I assume you want this

obsidian wolf
#

Ok. So click on office tv under controls, what do you see

lofty cave
#

Comes up

#

The power button did work on it.

obsidian wolf
#

Click the gear

#

What do you see

lofty cave
obsidian wolf
#

Ok, so the entity on that screen is the power toggle. You can copy that and put it on your dashboard. You don’t need the other Boolean or the automation.

lofty cave
#

Got it! Do you know how I would be able to do those other actions? For getting it to go directly to YoutubeTV or change channels?

#

Ultimately what I really want to do is get a remote on the dashboard to control the tv

obsidian wolf
lofty cave
#

I was looking at that earlier, but where would I end up inputing the information, in the automation creation (YAML)?

obsidian wolf
obsidian wolf
lofty cave
#

I will read this and see how it goes 🙄 I really really appreciate the assistance though!

lofty cave
#

So am trying to create the automation with the editing of YAML, but I am getting an error "Message malformed: extra keys not allowed @ data['type'] "

obsidian wolf
#

You’ve got an error in the yaml. Hard to say what specifically without seeing it.

lofty cave
#

This is what I typed in.

obsidian wolf
#

Your indents at minimum are wrong.