PHP Script error 65280

Post Reply
josimd
Posts: 51
Joined: Saturday 09 January 2016 20:47
Target OS: -
Domoticz version:
Contact:

PHP Script error 65280

Post by josimd » Friday 22 September 2017 20:48

I have a script which worked for a long time but suddenly stopped (Script error 65280) working (maybe due to the domo upgrade 3.8153)

Checked the IP address (are ok) mp3 locatie (ok), I have no clue what is wrong...anybody a suggestion? Thanks!


#!/usr/bin/env php
<?php
require_once '/volume1/appstore/scripts/php/sonos.class.php';
function find_ip_sonos($room_name)
{
$temp_stuff = new SonosPHPController('192.168.86.136’);
$devices = $temp_stuff->detect();

foreach ($devices as $device) {

if (strtoupper($device->device_info()['roomName']) == strtoupper($room_name)) {
$raw_ip=explode("-",$device->device_info()['friendlyName']);
return str_replace(" ","", $raw_ip[0]);
}
}
}

function do_notification() {
// put here code for other notification steps like a telegram message or pushover
}

// settings for the doorbell
$volume = 45;
$unmute= 0;
$file = 'http://192.168.86.136:8084/doorbell.mp3';

// nice doorbell: https://www.youtube.com/watch?v=TX7jlxtu7Rk
$potential_devices=array("192.168.86.121”);
$devices=array();

// get the time and compare with last doorbelpresstime
$now=time();
if (file_exists("/volume1/appstore/scripts/php/deurcontact.time") ) {
// read the session date if that exists
$lastchangedate=intval(file_get_contents("/volume1/appstore/scripts/php/deurcontact.time"));
}
else
$lastchangedate = 0;

// only fire up when there was a press 10 minutes ago
if (($now-$lastchangedate)>10*1) {
// Write the last press time
file_put_contents("/volume1/appstore/scripts/php/deurcontact.time", $now, LOCK_EX);

// we need to check if the devices are up and running, and build the array of devices to use
$temp_stuff = new SonosPHPController('192.168.86.136');
$present_devices = $temp_stuff->detect();
foreach ($present_devices as $present_device) {
$raw_ip=explode("-",$present_device->device_info()['friendlyName']);
$clean_ip=str_replace(" ","", $raw_ip[0]);

// is the device in the potential devices to use for the doorbell?
if (in_array($clean_ip, $potential_devices)) array_push( $devices, $clean_ip);
}

// create the instances and read the current status, initiate for final play
foreach ($devices as $a_device) {

// instantiate (devices must be on at all time
$sonos_1[$a_device] = new SonosPHPController($a_device);

// retrieve settings
$actual[$a_device]['track'] = $sonos_1[$a_device]->GetPositionInfo(); // this gives a notice if the radio is actually playing
$actual[$a_device]['volume'] = $sonos_1[$a_device]->GetVolume();
$actual[$a_device]['mute'] = $sonos_1[$a_device]->GetMute();
$actual[$a_device]['status'] = $sonos_1[$a_device]->GetTransportInfo();
$sonos_1[$a_device]->Pause();

// mute settings
if ($unmute == 1)
$sonos_1[$a_device]->SetMute(0);
if ($volume != 0)
$sonos_1[$a_device]->SetVolume($volume);

// check the type of sound playing
if (((stripos($actual[$a_device]['track']["TrackURI"],"x-file-cifs://")) != false) or ((stripos($actual[$a_device]['track']["TrackURI"],".mp3")) != false))
{
$actual[$a_device]['is_mp3']=true;
$TrackNumber[$a_device] = $sonos_1[$a_device]->AddURIToQueue($file);
$sonos_1[$a_device]->ChangeTrack($TrackNumber[$a_device]);
}
else
{
$actual[$a_device]['is_mp3']=false;
$sonos_1[$a_device]->SetQueue($file);
}
}

// lets play at the same time
foreach ($devices as $a_device) {
$sonos_1[$a_device]->Play();
}
sleep(2);

// do the other notification steps
do_notification();

// wait until all devices have finished
foreach ($devices as $a_device)
while ($sonos_1[$a_device]->GetTransportInfo() == "PLAYING") {}

// and revert to old playlist
foreach ($devices as $a_device) {

if ($actual[$a_device]['is_mp3'])
{
$sonos_1[$a_device]->Pause();
$sonos_1[$a_device]->SetVolume($actual[$a_device]['volume']);
$sonos_1[$a_device]->SetMute($actual[$a_device]['mute']);
$sonos_1[$a_device]->ChangeTrack($actual[$a_device]['track']["TrackNumberInQueue"]);
$sonos_1[$a_device]->SeekTime($actual[$a_device]['track']["RelTime"]);
$sonos_1[$a_device]->RemoveTrackFromQueue($TrackNumber[$a_device]);
}
else
{
$sonos_1[$a_device]->Pause();
$sonos_1[$a_device]->SetVolume($actual[$a_device]['volume']);
$sonos_1[$a_device]->SetMute($actual[$a_device]['mute']);
$sonos_1[$a_device]->SetQueue($actual[$a_device]['track']["TrackURI"]);
}
}

// final step to continue playing
foreach ($devices as $a_device)
if (strcmp($actual[$a_device]['status'],"PLAYING") == 0)
$sonos_1[$a_device]->Play();
}

else
{
// otherwise: do nothing
};


?>

holdemblow
Posts: 2
Joined: Friday 18 November 2016 14:55
Target OS: Raspberry Pi
Domoticz version: 3.8153
Contact:

Re: PHP Script error 65280

Post by holdemblow » Wednesday 18 October 2017 9:46

- domoticz rpi
- 1X RFXtrx433e USB 433.92MHz Transceiver
- 3x kaku plugs
- 3x Action kaku-like plugs
- 1x kaku inbouw
- 1x kak deurbel
- 3x Flamingo FA21RF
- 1 aeon labs z-wave plus
- neocoolcam NAS-WR01ZE smart stekker

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests