PiPup icon indicating copy to clipboard operation
PiPup copied to clipboard

invalid request: invalid method

Open wonderbraun opened this issue 3 years ago • 2 comments

Hello I'm new to home assistant and I'm trying to get this app working. Installed on my Android TV set top box from Play Store (and also allowed notifications via adb shell) but nothing happens. I put this in my configuration.yaml:

rest_command: androidtv_notification: url: http://192.168.5.241:7979/notify content_type: 'application/json' verify_ssl: false method: 'post' timeout: 20

And then this in automation:

service: rest_command.androidtv_notification data: duration: 10 position: 2 title: Home Assistant titleColor: '#50BFF2' titleSize: 10 message: Movimento rilevato messageColor: '#fbf5f5' messageSize: 14 backgroundColor: '#0f0e0e' media: image: uri: 'https://XXXXX.duckdns.org/local/arlo/terrazzo.jpg' width: 580

If I try to access http://192.168.5.241:7979/notify (local address of my Android TV) i just got an error message after a few seconds saying invalid request: invalid method

What am I doing wrong? Thanks

wonderbraun avatar Nov 06 '20 01:11 wonderbraun

I have used this in my configuration.yaml file for sending a notification to PiPup from Home Assistant. Then, in an automation, I just call the service rest_command.pipup.

rest_command:
  pipup:
    url: 'http://192.168.1.66:7979/notify'
    method: post
    content_type: 'application/json'
    payload: '{ "duration": 7, "position": 0, "title": "🚪 Door Opened!", "titleColor": "#DDEEDD", "titleSize": 20, "backgroundColor": "#112233" }'

It may be that you need to rename data to payload, but I'm not sure if that's the solution. Hope this helps!

stevenflesch avatar Nov 06 '20 02:11 stevenflesch

Ok I pasted your code and everything worked flawlessly, I was doing a mess by pasting code and switching from raw editor to ui editor. If someone like me has a multiple camera setup and wants to get a notification with thumbnail this is the right way of doing it. In configuration.yaml:

rest_command:
  androidtv_notification:
    url: 'http://192.168.5.241:7979/notify'
    method: post
    content_type: 'application/json'
    payload: '{ "duration": 10, "position": 2, "title": "Motion detected", "message": "{{ message }}", "titleColor": "#50BFF2", "titleSize": 10, "messageColor": "#fbf5f5", "messageSize": 14, "backgroundColor": "#0f0e0e", "media": { "image": { "uri": "{{ image }}", "width": 580 } } }'

And in automation action:

service: rest_command.androidtv_notification
data:
  message: Front porch
  image: 'https://XXXXXX.duckdns.org/local/arlo/terrazzo.jpg'

Thanks for the support!

wonderbraun avatar Nov 06 '20 14:11 wonderbraun