Help with hassio call from node-red

I have automation in home assistant that keeps failing. I can run it manually and works fine . Anyways sick of it and moving script to node red. I just dont know how to call amcrest.go_topreset and pass value. Below is my current automation in HA. Thanks for the help.

  • id: ‘1553648451741’
    alias: Camera Normal
    trigger:
    • entity_id: device_tracker.someone
      from: home
      platform: state
      to: not_home
      condition: []
      action:
    • data:
      entity_id: switch.camera
      service: switch.turn_on
    • delay: 00:01:00
    • data:
      entity_id: all
      preset: ‘1’
      service: amcrest.goto_preset

Someone have some input?

In node-red did the domain/service/entity give you a drop down or did you manually type them in?

Just looking at the screen shots, it looks like you manually typed them in as node-red doesn’t match HA:

node-red service:  amcrest_goto_preset
Home Assistant :   amcrest.goto_preset      (dot instead of underscore)

If you manually typed them, change the first underscore to a dot and see if it works.
In my setup I have the drop downs working, not sure if there are some setups that this doesn’t work.

DeadEnd

Only one that was not typed in was camera. both service and entity was.

Okay, so the service is correct now, and you are getting a different error.
Now it looks like Node Red is not communicating with Home Assistant…
That actually sounds like a step backwards… can you check that Home Assistant is running, and that Node-Red is connecting to it?

If I run this. It runs fine. So I am guessing connection to HA is fine?

hmm… Can you show your server setup - remove/cover and confidential info (IP, token, etc. if they are shown).

I don’t use Hass.IO or add-ons but I have found a few different forum posts where node-red addon wasn’t working well and they just removed and re-added it. This fixed their issue - but I can’t say that will help you as it is just a random thing.

Also, can you also check if the node in node-red is showing connected or not connected (or nothing):
image image

Here is some info for you.

API error…

image

NOTE: I do have two servers set up to test this. here is the other server. Not currently used.

Eureka!
I think I found your problem.
At some point the components were updated and you are using the wrong domain.
I added an Amcrest camera and found that there is a domain just for the Amcrest.

Try this setup:
image

FYI this should also allow the drop-downs to be used in all three boxes.

I cant find the domain?

image

Unfortunately i don’t have the same setup as you so I am not sure.
You can try restarting the add-on (if you haven’t already).

Other than that, you can try just typing it in and see if it works (matching what I sent).

WOOT WOOT. I got it to show now. Not sure how.

I think its cause i reinstalled amcrest then restart both HA and node-red

But now it doesnt turn the camera to the preset.

image

hmm… I don’t know how much I can help on that part…
Test other present #'s maybe?
But I don’t have an amcrest camera, so I don’t know if I can help since I don’t have a setup to check.

If the camera has a log, I would check that, and also the HA log to see if there is anything helpful there.

DeadEnd

not sure how to “login”
“Could not move Amcrest Camera camera to preset 3 due to error: LoginError”

hmm… that sounds like the account you have setup in configuration.yaml for the Amcrest camera does not have permission to change the preset.

Can you check the permissions of that account on the camera?

This automation works below in hassio. I just the username I am using has full permission same as admin.

Correction. its working now. Not sure why though.

[{"id":"1240d09e.875f9f","type":"inject","z":"1d1cd377.dca10d","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":580,"wires":[["29a5b93.e925546"]]},{"id":"29a5b93.e925546","type":"api-call-service","z":"1d1cd377.dca10d","name":"","server":"57ecce73.d1658","service_domain":"amcrest","service":"goto_preset","data":"{\"entity_id\":\"camera.amcrest_camera\",\"preset\":\"1\"}","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":390,"y":520,"wires":[["ea46b6a7.8dd9d8"]]},{"id":"ea46b6a7.8dd9d8","type":"debug","z":"1d1cd377.dca10d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":630,"y":460,"wires":[]},{"id":"57ecce73.d1658","type":"server","z":"","name":"Home Assistant"}]

image

So everything is working now?

I hope so :slight_smile:

So far ha ha ha.

Now I need to figure out how to get rid of this… grrr

image

(Captian Obvious here…)
You’ll have to check out those two nodes and see what is not configured correctly. :slight_smile:

it is obvious but I cant find it ha ha. It goes no where when i click

I think i got it. I deleted it from \node-red\flows.json

Got one more I gotta try to delete somehow

Ok its deleted. We all good!

image