New to HA and struggling with automation

Hi All,

So I am new to HA after being an ST user and I am trying to get my head around what feels like super complex processes for something I previously found a breeze to setup.

I have some Greenwave ZWave Plugs (UK), there is a post on here already about the issue where it flashing a green light when it receives no communication after x time.
Min 2 and max 255 mins.
The post mentioned about using a ping command, however it stats this has been changed to a push instead.

That’s fine, but I’m getting a little frustrated as I navigate through many help topics which only ever partially answer the solution.

The example on the original post was “here is some code to resolve the issue and pings it every hour”
That’s fantastic,
So how do I make that code an automation.

I’ve tried so many options to try and get the pin automation using the gui to get it to trigger a ping to the plug every hour and I can not for the life of me work out what is going wrong.

But when I compare the code it shows no intent or obvious target to the trigger for the automation.
I presume the trigger is choosing hour often it should run.

Please be aware I am new to this and I really need to hunt down answers that are guiding me through the process and not just. Here is some code.

I really don’t want to hand in the towel with HA as I’ve spent a chunk on new equipment for this but I’m already pulling my hair out and I’ve not even started digging into how I run the ST equivalent or “goodnight scene” putting the house in night mode etc. good morning for day mode.
I’m starting to think this might be many hours of work for something that took 5 mins in ST lol.

Eagerly awaiting some help :prayer_beads:

I’m guessing you can just then use this:

Ping (ICMP) - Home Assistant

</s> <s>binary_sensor:</s> <s> - platform: ping</s> <s> host: 192.168.0.1</s> <s> name: "device name"</s> <s> count: 1</s> <s> scan_interval: 1200</s> <s>

add that to your config and that IP will be pinged every 20 minutes. No automation needed. Let HA do it internally.

I came from ST. Its simpler and yet its more complex when you deviate from anything not very basic… Hang in there. HA is way better.

1 Like

btw, are you referring to this?

- id: '1637435010797'
  alias: Zwave keepalive
  description: ''
  trigger:
  - platform: time_pattern
    minutes: '5'
  condition: []
  action:
  - service: zwave_js.ping
    target:
      device_id:
      - 925a2ca2993fffacde32793e9d1b304a
      - 1911bfd63041fcb87d3e4bfa13d5b8e0
      - ff9b525fe72d82025325e8daa33a46cf
      - df52f96b458e4919889dbff9a3055b7e
  mode: single

What questions do you have around it? Maybe you can use that if I understand what your’re having trouble with?

Hey Rob,

Yes that’s the one.

At this time I literally don’t know how I take that code and implement it.
As the post itself does not really say.

Also if I simply copy that code do I need to change any parameters or is it a simple copy and paste.

Im just assuming I do this from the device type page of the plug and click automations or is it script.

When I look at the code view of the automation I’m trying to make it doesn’t like too dissimilar.

So really just trying to get my head around the basics and feel like I’m failing at such an early stage of something as basic as automations lol.

It should be a literal copy/paste (without the ID line and removing the fist 2 spaces in each row before pasting) but with your device_ids. Do you know how to find them?

No it won’t be a simple copy paste for that code. It will have to be modified.

The ZWaveJS ping service was depricated in favor of a ‘button’ implementation earlier this year. So instead of a ‘ping’ call like in that code, you have to issue button.press to the corresponding button.[devicename]_ping (or something like that, I’m doing this from memory)

Theres a couple posts here about pinging dead ZWave nodes. Look at the end of those posts, the recent scripts have the fixed code.

Also. Welcome. It will get easier. It will suck for a while as you learn but it will be worth it.

Thanks for correcting that.

1 Like

It’s an automation. See the trigger? Scripts don’t have a trigger. Scripts are a sequence of actions that are run when you start them manually (like in the UI) or call them from some other automation/script as an action.

Automations are basically scripts with one or more triggers. They run a set of actions when one of their triggers fire. They can also be run manually from the UI but generally that’s only for debugging.

So you can almost paste it in there. The code above is shared in a way that makes it easy to paste into your configuration.yaml file under the automation key. If you add a new automation from Settings → Automations and switch to code view you’ll have to tweak it to paste there. Couple issues:

  • id is generated for you when you use the automation editor. Don’t paste that in or you’ll create a conflict with the already generated one
  • In the automation editor’s code view you’re only looking at the one automation. So the entire thing is a single YAML object/dictionary. Notice how in the code above it the entire thing starts with a - signifying that it is an item in a list. You have to remove that, it will cause an error if you leave that in when pasting into the code view of the automation editor.

Also as noted above device ids are unique to each HA instance. Copying and pasting those won’t work. You have to get the ones for your devices. Use the automation editor in the normal view (not code view) and select your devices.

This is my original code, as mentioned the ping was depreciated so now use the refresh values action, so I have amended the automation, you would need to put your devices in there.

alias: Zwave keepalive
description: ''
trigger:
  - platform: time_pattern
    minutes: '5'
condition: []
action:
  - service: zwave_js.refresh_value
    data:
      entity_id: switch.bedroom_powernode
      refresh_all_values: true
  - service: zwave_js.refresh_value
    data:
      entity_id: switch.livingroom_powernode_1
      refresh_all_values: true
  - service: zwave_js.refresh_value
    data:
      entity_id: switch.livingroom_powernode_2
      refresh_all_values: true
  - service: zwave_js.refresh_value
    data:
      entity_id: switch.office_powernode
      refresh_all_values: true
  - service: zwave_js.refresh_value
    data:
      entity_id: switch.living_room_av
      refresh_all_values: true
mode: single

It sounds like you are having trouble getting to grips with creating automation.

This is quite a simple automation and can be setup visually - i’ll paste some screenshots

Add as many actions as you have devices

Hope this helps

1 Like

Ahh Mannnnn. Thanks all, I have been pulling my hair out on this one. I was kind of on the right lines with the time_pattern but I just never seemed to trigger, although I was trying to do the wrong action after all this.

@cleggton I have setup as this, I run it and tadaa it stopped flashing :slight_smile:
But with the example, I presume this will run every 5 minutes ?

As I am sitting here watching and the last trigger remains at the time a run in manually.
This was the issue I have been getting where the time_pattern seems to not continue as per the time span etc.

I am looking at the automations section and the “last triggered” never seems to change.
If I click on the More Information this confirms the last trigger was when I setup this and run it manually. 21:05 (UK) Time.

This will trigger at 5 past the hour.

Try the automation docs.